#include<iostream>
using namespace std;
int n, s, ans = 0;
void dfs(int cnt, int sum, int now);
int main() {
    while (1) {
        cin >> n >> s;
        if (n == 0 && s == 0) break;
        ans = 0; //when call dfs next time, ans should start from 0
        dfs(0, 0, 0);
        cout << ans << endl;
    }
}
void dfs(int cnt, int sum, int now) {
    if (now > 9) {
        if (cnt == n && sum == s) {
            ans++;
        }
        return;
    }
    dfs(cnt + 1, sum + now, now + 1);
    dfs(cnt, sum, now + 1);
    return;
}

