#include <bits/stdc++.h>
using namespace std;
template <typename T>
class MinPq : public priority_queue<T, vector<T>, greater<T> > {};
template <typename T>
class MaxPq : public priority_queue<T, vector<T>, less<T> > {};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k, l, r;
  cin >> n >> k;
  l = 0;
  r = n;
  while (((l * (l + 1)) / 2) < (n - l)) l++;
  while (l < r) {
    long long int m = l + (r - l) / 2;
    long long int v = (m * (m + 1)) / 2 - (n - m);
    if (v < k)
      l = m + 1;
    else
      r = m;
  }
  cout << n - l << '\n';
  return 0;
}
