#include <iostream>
using namespace std;

int solve(int n, int index, int s) {
    if (n == 0 && s == 0) {
        return 1;
    } else if (n == 0 || s <= 0 || index > s) {
        return 0;
    }
    int res = 0;
    res += solve(n - 1, index + 1, s - index);
    res += solve(n, index + 1, s);
    return res;
}

int main() {
    while (true) {
        int n, s;
        cin >> n >> s;
        if ((n | s) == 0) {
            break;
        }
        cout << solve(n, 0, s) << endl;
    }
}