#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"
string s;
int n,k;
int ans(int l, int r)
{
if (r>=l)
{
long long idx = l + (r - l) / 2;
long long int o= idx*(idx+1)/2;
if (o-(n-idx)==k) return idx;
else if (o-(n-idx)>k) return ans(l,idx-1);
else return ans(idx+1,r);
}
return -1;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n >> k;
cout<<n-ans(1,n);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKdHlwZWRlZiBsb25nIGxvbmcgaW50IGxsOwp0eXBlZGVmIHVuc2lnbmVkIGxvbmcgbG9uZyBpbnQgdWxsOwp0eXBlZGVmIGxvbmcgZG91YmxlIGxkOwp0eXBlZGVmIHBhaXIgPGxsLCBsbD4gcGxsOwp0eXBlZGVmIHBhaXIgPGludCwgaW50PiBwaWk7CiAKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBtcCBtYWtlX3BhaXIKI2RlZmluZSBmZiBmaXJzdAojZGVmaW5lIHNzIHNlY29uZAojZGVmaW5lIGFsbChhKSBhLmJlZ2luKCksIGEuZW5kKCkKI2RlZmluZSBzeihhKSAobGwpKGEuc2l6ZSgpKQojZGVmaW5lIGVuZGwgIlxuIgpzdHJpbmcgczsKaW50IG4sazsKIAppbnQgYW5zKGludCBsLCBpbnQgcikKewogIAlpZiAocj49bCkKCQl7IAoJICAJICBsb25nIGxvbmcgaWR4ID0gbCArIChyIC0gbCkgLyAyOyAKCQkgIGxvbmcgbG9uZyBpbnQgbz0gaWR4KihpZHgrMSkvMjsKCQkKCQkgIGlmIChvLShuLWlkeCk9PWspICAgICAgICAgcmV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