#include<bits/stdc++.h>
using namespace std;
int ans;
void serch(int i,int j,int n)
{
    if(!n&&!j){
        ans++;
        return;
    }
    else if(i==10||!n)return;
    serch(i+1,j-i,n-1);
    serch(i+1,j,n);
}
int main()
{
    int n,s;
    while(cin>>n>>s&&(n!=0&&s!=0)){
            ans=0;
            serch(0,s,n);
            cout<<ans<<endl;
    }
}