#include <bits/stdc++.h>

using namespace std;
const int N = 12;
int n, s;
int ans = 0;

void bt(int sum, int index, int pos) {
	if(sum == 0) {
		ans++;
		return;
	}
    if(pos == n) return;
	
	if(sum < 0) return;
	
	for(int i = index; i < s; i++) {
		bt(sum - (i + 1), i + 1, pos + 1);
	}
}

int main() {
	while(true) {
	    cin >> n >> s;
	    if(!n && !s) return 0;
	    if(n == 2) {
	    	cout << n / 2 + 1 << "\n";
	    	continue;
		}
	    bt(s, 0, 0);
	    cout << ans - 1 << "\n";
	    ans = 0;
	}
    return 0;
}