#include <iostream>
//#include <fstream>
using namespace std;
int ans,n,s;
 
void dfs(int cnt,int sum,int i){
	if(sum==s&&cnt==n){
        ++ans;
        return;
    }
    if(sum>s||cnt>n||i>9){
        return;
    }
    dfs(cnt,sum,i+1);
    dfs(cnt+1,sum+i,i+1);
    return;
};
 
int main(){
    while(cin>>n>>s&&n&&s){
        ans=0;
        dfs(0,0,0);
        cout << ans << "\n";
    }
    return 0;
}