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