#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-11;
const int INF = ~(1 << 31);
const long long LINF = ~(1LL << 63);
const int MOD = 1e9 + 7;
const long long MAXN = 51;
void fail() {
  cout << "No";
  exit(0);
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long a = 1, b = n;
  while (a <= b) {
    long long mid = (a + b) / 2;
    long long candiesLeft = (mid + 1) * mid / 2 - (n - mid);
    if (candiesLeft == k) {
      cout << (n - mid);
      return 0;
    }
    if (candiesLeft < k) {
      a = mid + 1;
    } else {
      b = mid - 1;
    }
  }
  return 0;
}
