#include <bits/stdc++.h>
using namespace std;
void go() {
  int n, k;
  cin >> n >> k;
  int a = 0;
  int cn = 0;
  int pre = 1;
  int no = 0;
  while (no < n) {
    while (no < n && a + pre <= k) {
      a += pre;
      pre += 1;
      no++;
    }
    if (no == n) break;
    cn++;
    a -= 1;
    no++;
  }
  cout << cn << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    go();
  }
  return 0;
}
