#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int INF = INT_MAX;
int main() {
  long long n, i, k, sum, sub, ans;
  scanf("%lld%lld", &n, &k);
  sum = 0;
  sub = 0;
  ans = 0;
  i = 1;
  while (sum < k) {
    sum += i;
    i++;
    n--;
  }
  while (n--) {
    if (sum >= k) {
      sum--;
      ans++;
    } else {
      sum += i;
      i++;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
