#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
int n,s;
while(cin>>n>>s,n||s){
bool in[10]={0};
rep(i,n)in[i]=1;
sort(in,in+10);
int co=0;
do{
int sum=0;
rep(i,10)if(in[i])sum+=i;
if(sum==s)co++;
}while(next_permutation(in,in+10));
cout<<co<<endl;
}
}