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

int dfs(int n, int s, int i, int acc){
    if(n == 0) return s == acc ? 1 : 0;
    else if(i == 9) return 0;

    int res = 0;
    for(int j=i+1;j<=9;++j) res += dfs(n-1, s, j, acc + j);
    return res;
}

int main(){
    int n, s;
    while(cin >> n >> s, n != 0){
        int ans = 0;
        for(int i=0;i<=9;++i) ans += dfs(n-1, s, i, i);
        cout << ans << endl;
    }

    return 0;
}
