#include<iostream>
#include<cstdio>
using namespace std;
int serch(int n,int s,int now,int re,int k)
{
    if(k==n&&re+now==s)return 1;
    if(now-1<0)return 0;
    if(re+now<s)serch(n,s,now-1,re+now,k+1);
    if(re+now>s)serch(n,s,now-1,re,k);
}
int main()
{
    int n,s,ans;
    while(1){
        cin>>n>>s;
        if(n==0&&s==0)break;
        if(9*n<s)ans=0;
        else ans=serch(n,s,9,0,1);
        cout<<ans/2<<endl;
    }
}