#include <bits/stdc++.h>
using namespace std;

int n, s;

int dfs(int i, int sum, int n) {
    if (i == 10) {
        if (n == 0 && sum == s)
            return 1;
        return 0;
    }
    return dfs(i + 1, sum + i, n - 1) + dfs(i + 1, sum, n);
}

int main(void) {
    while (cin >> n >> s) {
        if (n == 0 && s == 0)
            break;
        cout << dfs(0, 0, n) << endl;
    }
    cout << 0 << endl;
    return 0;
}
