#include <bits/stdc++.h>
int main() {
  long long n, k, v, ans = 0;
  scanf("%lld%lld", &n, &k);
  v = n * (n + 1) / 2;
  while (v > k) {
    v -= n;
    v--;
    n--;
    ans++;
  }
  printf("%lld\n", ans);
}
