#include <bits/stdc++.h>
#include<iostream>
#include<bitset>
#include<unordered_set>
#include<algorithm>
using namespace std;
#define int long long
#define ld long double
#define ull unsigned long long
#define endl '\n'
#define pb push_back
#define pf push_front
#define sz(s)	(int)(s.size())
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define pq priority_queue
#define mp make_pair
#define S second
#define F first
#define cin(v) for(auto &it:v)cin>>it;
#define cinG(grid) for(auto &r:grid) for(auto &c:r)cin>>c;
#define cout(v) for(auto &it:v)cout<<it<<" ";
#define ret return
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<int, int>> vpi;

int Inf = 2e18;
int num;
const int mod = 1e9 + 7;
//solve


const int N = 2e3 + 5;
int di[8]{ 1 , -1 , 0 ,  0 , 1 ,  1 , -1 , -1 };
int dj[8]{ 0 ,  0 , 1 , -1 , 1 , -1 , -1 ,  1 };
char dv[4]{ 'D','U','R','L' };



int can(int addCandiesTimes, int n, int rc) {
	int totallC = addCandiesTimes * (addCandiesTimes + 1) / 2;
	int ateTimes = totallC - rc;
	ret ateTimes;
}


void Zero() {
	int n, rc; cin >> n >> rc;
	int l = 0, r = n;
	int ans = 0;
	while (l <= r) {
		int addCTimes = l + ((r - l) >> 1);
		int ateTimes = can(addCTimes, n, rc);
		if (ateTimes + addCTimes == n) {
			ans = ateTimes;
			break;
		}
		else if (ateTimes + addCTimes < n) {
			l = addCTimes + 1;
		}
		else {
			r = addCTimes - 1;
		}
	}

	cout << ans << endl;

}

void solve() {
	int tc = 1;

	//put pre processing functions here


	//cin >> tc;
	while (tc--) {
		Zero();
	}
}

signed main() {
	// ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); // Not needed with scanf/printf
	solve();
	return 0;
}