#include<iostream>
using namespace std;

int n,s,ans = 0;

//???????????°??????????¨???????????????°????????°
void dfs(int i,int sum,int num){
    
    if(num == n){
        
        if(sum == s){
            ans++;
        }
        return;
    }
    if(i == 10){
        return;
    }
    //i????????°??????,??????????????°????¶?????????????
    dfs(i+1,sum,num);
    //i????????¶
    dfs(i+1,sum + i,num+1);
}

int main(){

    while(cin >> n >> s){
        if(n == 0 && s == 0){
            break;
        }
        dfs(0,0,0);
        cout << ans << endl;
        ans = 0;
    }

    return 0;
}