#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long sum = 0, i = 1;
  while (sum < k) {
    sum += i;
    i++;
  }
  i--;
  while (n != sum - k + i) {
    i++;
    sum += i;
  }
  cout << sum - k << "\n";
}
