#include <iostream>

using namespace std;

int count(int m, int n, int s) {
    if (n == 1) {
        if (s >= m) return 1;
        return 0;
    }
    int c = 0;
    for (int i = m; i < 9; i++) {
        c += count(i + 1, n - 1, s - i);
    }
    return c;
}

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