#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const long long INF = (long long)1e18;
int cnt, sum;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long l = -1, r = n + 1;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if ((n - mid) * (n - mid + 1) / 2 - mid > m)
      l = mid;
    else
      r = mid;
  }
  cout << r;
}
