#include<iostream>

using namespace std;

int main(){

  int n, s, x;

  while(1){

    cin >> n >> s;

    if(n == 0 && s == 0) break;

    x = n *(n-1) / 2;

    s -= x;

    if(s >= n){
      if(n < 0)n=0;
      cout << n<< endl;
    }else{
      if(s < 0)s=0;
      cout << s << endl;
    }

  }
  return 0;

}