#include <bits/stdc++.h>
using namespace std;
long long n, k;
bool check(long long x) {
  long long tmp = (n - x + 1) * (n - x) / 2;
  if (tmp - x >= k)
    return true;
  else
    return false;
}
int main() {
  cin >> n >> k;
  long long r, l, ans;
  l = 0;
  r = n;
  while (l <= r) {
    long long mid = (r + l) / 2;
    if (check(mid)) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  cout << ans << endl;
  return 0;
}
