#include <bits/stdc++.h>
using namespace std;
long long n, k, l, r, mid;
int main() {
  scanf("%lld %lld", &n, &k);
  l = 0;
  r = n;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (mid * (mid + 1) / 2 - (n - mid) > k) {
      r = mid - 1;
    } else if (mid * (mid + 1) / 2 - (n - mid) < k) {
      l = mid + 1;
    } else {
      printf("%lld\n", n - mid);
      break;
    }
  }
}
