#include <bits/stdc++.h>
using namespace std;
void solve(long long int n, long long int k) {
  long long int ans = 0;
  long long int low = 0;
  long long int high = 1e9;
  while (low <= high) {
    long long int mid = (low + high) / 2;
    long long int temp = ((mid) * (mid + 1)) / 2;
    long long int rem = n - mid;
    temp = temp - rem;
    if (temp == k) {
      cout << rem;
      return;
    } else if (temp > k) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
}
int main() {
  long long int t;
  t = 1;
  while (t--) {
    long long int n;
    long long int k;
    cin >> n >> k;
    solve(n, k);
  }
  return 0;
}
