#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <cmath>
#include <type_traits>

int main(void){
	using namespace std;

	vector<pair<unsigned int, unsigned int>> input;
	map<unsigned int, unsigned int> Smax;
	map<unsigned int, map<unsigned int, unsigned int>> N;

	{
		unsigned int n,s;
		while(cin >> n >> s){
			if(n==0 && s==0){
				break;
			}
			input.push_back( make_pair(n,s) );
			N[n];
			Smax[n] = std::max(Smax[n],s);
		}
	}

	for(auto itr=N.begin(); itr!=N.end(); itr++){
		unsigned int n = itr->first;
		unsigned int smax = Smax[n];

		if ( (n-1)*n/2 > smax ){
			continue;
		}
		vector<bool> permTable(smax+1);
		fill(permTable.begin()+n, permTable.end(), true);
		do {
			unsigned int sum = 0;
			for (unsigned int i=0; i<=smax; i++) {
				if (!permTable[i]) {
					sum += i;
				}
			}
			itr->second[sum]++;
		} while (std::next_permutation(permTable.begin(), permTable.end()));
	}

	for (auto itr=input.begin(); itr!=input.end(); itr++){
		cout << N[itr->first][itr->second] << endl;
	}
}