#include <bits/stdc++.h>
using namespace std;
long long n, x, hal, k, ans, sum;
int a[200200];
long long check(long long mid) { return (mid * (mid + 1)) / 2 - (n - mid); }
long long bs(long long l, long long r) {
  if (l > r) return -1;
  long long mid = (l + r) / 2;
  if (check(mid) == k) return mid;
  if (check(mid) > k) return bs(l, mid - 1);
  return bs(mid + 1, r);
}
int main() {
  cin >> n >> k;
  cout << n - bs(1, n);
  return 0;
}
