#include <iostream>
#include <algorithm>
using namespace std;
int factorial(int n){
	int x = 1;
	for(int i=1;i<=n;++i){
		x*=i;
	}
	return x;
}
int solve(int *used,int n,int sum,int target,int count){
	if(n==0){
		if(sum==target)return count+1;
		return count;
	}
	for(int i=0;i<10;++i){
		int u[10];
		for(int j=0;j<10;++j)u[j]=used[j];
		if(used[i]==0){
			u[i]=1;
			count = solve(u,n-1,sum+i,target,count);
		}
	}
	return count;
}
int main(void){
	int n,s;
	while(cin>>n>>s,n,s){
		int used[10]={0};
		int count = solve(used,n,0,s,0);
		cout<<count/factorial(n)<<endl;
	}
	return 0;
}