#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long l = 1, u = n, mid;
  while (l <= u) {
    mid = (l + u) / 2;
    long long sum = (mid * (mid + 1)) / 2;
    sum = sum - (n - mid);
    if (sum == k) {
      cout << n - mid << endl;
      break;
    } else if (sum < k) {
      l = mid + 1;
    } else
      u = mid - 1;
  }
  return 0;
}
