#include <iostream>
using namespace std;

int aol97(int n, int s)
{
	if (0 > s or n <= 0 or (n * (n - 1) / 2 > s)){
		return 0;
	}else if (n * (n - 1) / 2 == s or n == 1){
		return 1;
	}else{
		return aol97(n - 1, s - 1) + aol97(n, s - n) - aol97(n - 2, s - 2);
	}
}
int main(){
	int n, s;
	cin >> n >> s;
	while (n != 0 or s != 0){
		cout << aol97(n, s) << "\n";
		cin >> n >> s;
	}
	return 0;
}