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

using i64 = long long int;

int main(){
    int n, s;
    while(cin >> n >> s, n != 0){
        int ans = 0;
        for(int i=0;i<(1<<10);++i){
            int sum = 0, bit = 0;
            for(int j=0;j<10;++j){
                if((i>>j)&1){
                    sum += j;
                    bit++;
                }
            }
            if(bit == n && sum == s)ans++;
        }
        cout << ans << endl;
    }

    return 0;
}

