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

int solve(int n, int s, int pre) {
    if(n == 0) {
        return s == 0;
    }
    if(9*n < s) {
        return 0;
    }
    int res = 0;
    for(int i=pre+1; i<=min(s, 9); ++i) {
        res += solve(n-1, s-i, i);
    }
    return res;
}

int main() {
    int n, s;
    while(cin >> n >> s, n) {
        cout << solve(n, s, -1) << endl;
    }
}
