#include<stdio.h>
int sum(int a,int x,int n,int n2,int s);
int hako[10];
int type;

int main(void){
	int n,s;
	
	while(1){
		scanf("%d %d",&n,
			&s);
		if(n==0&&s==0){break;}
		type=0;
		type=sum(0,0,n,n,s);
		printf("%d\n",type);
	}
	return 0;
}

int sum(int a,int x,int n,int n2,int s)
{
	int i,sum_num=0;
	
	if(n==0){
		sum_num=0;
		for(i=0;i<n2;i++){
			sum_num+=hako[i];
		}
		if(s==sum_num){
			type++;
		}
		return type;
	}
	for(i=a;i<=9;i++){
		hako[x]=i;;
		if(x!=0){
			if(hako[x-1]==hako[x]){
				continue;
			}
		}
		sum(i+1,x+1,n-1,n2,s);
	}
	return type;
}