#include <bits/stdc++.h>
using namespace std;
int main() {
  long long steps, candies, temp = 0, count = 1, ate = 0;
  cin >> steps >> candies;
  for (int i = 1; i <= steps; i++) {
    if (i % 2 != 0) {
      temp += count++;
    } else {
      temp--;
      ate++;
    }
  }
  if (temp == candies) {
    cout << ate;
  } else if (temp > candies) {
    while (temp > candies) {
      temp -= count--;
      ate++;
    }
    if (temp < candies) ate--;
    cout << ate;
  } else if (temp < candies) {
    while (temp < candies) {
      ate--;
      temp += count++;
    }
    if (temp > candies) ate++;
    cout << ate;
  }
  return 0;
}
