#include <bits/stdc++.h>
using namespace std;
using ll = long long;
signed main() {
  cin.tie(0);
  cin.sync_with_stdio();
  ll n, k;
  cin >> n >> k;
  ll a = 1;
  while (a * (a + 1) / 2 < k) {
    a++;
  }
  while ((a) * (a + 1) / 2 - k + a < n) {
    a++;
  }
  cout << (a) * (a + 1) / 2 - k;
}
