#include <bits/stdc++.h>
const int INF = (int)1e9;
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  int l = 0, r = n;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    long long cnt = (long long)(n - mid) * (n - mid + 1) / 2;
    if (cnt - mid < k) {
      r = mid - 1;
    } else if (cnt - mid > k) {
      l = mid + 1;
    } else {
      cout << mid << '\n';
      return 0;
    }
  }
  return 0;
}
