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