#include <bits/stdc++.h>
using namespace std;
const long long int mod = 998244353;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, k;
  cin >> n >> k;
  long long int req = 0;
  bool m = 0;
  for (long long int i = 1; i <= n; i++) {
    req += i;
    if (req < k) continue;
    if (req - k == n - i) {
      req -= k;
      m = 1;
      break;
    }
  }
  !m ? cout << "0" : cout << req;
}
