#include <iostream>
using namespace std;

static int m;

void p(int s,int n,int a[],int j) {
	int i;
	int hokanj=0;
	if(s<0)return;
	if(s==0 && n==0){m++;return;}
	for(i=j+1;i<=9;i++){
		if(a[i]==0){a[i]=1;s-=i;hokanj=j;j=i;p(s,--n,a,j);}
		a[i]=0;s+=i;++n;j=hokanj;
	}
	return;
	
}
int partition(int s,int n, int a[]) {
	p(s,n,a,-1);
	return m;
}

int main(void){
	int s=1,n=1;
	while(scanf("%d %d",&n,&s)>0 && (n!=0 || s!=0)){
		m=0;
		int a[]={0,0,0,0,0,0,0,0,0,0};
		partition(s, n, a);
		printf("%d\n",m);
	}
	return 0;
}
