#include <bits/stdc++.h>
using namespace std;
long long check(long long mid, long long n, long long k) {
  long long x = n - mid;
  long long val = (mid * (mid + 1)) / 2;
  val -= x;
  if (val == k) return 0;
  if (val > k) return -1;
  return 1;
}
int main() {
  long long n, k, x, a, low, high, mid;
  cin >> n >> k;
  low = 1;
  high = n;
  while (low <= high) {
    mid = (low + high) / 2;
    x = check(mid, n, k);
    if (x == 0) {
      cout << n - mid << endl;
      return 0;
    }
    if (x == -1)
      high = mid - 1;
    else
      low = mid + 1;
  }
  return 0;
}
