#include <stdio.h>
 
int i,n,s;
 
void part(int cal, int index, int sum){
			if(index == 9 && cal == n && sum == s){
			i++;
			return;	
			} 
			
			if(index > 9|| cal > n||sum > s) return;
			
	part(cal, index + 1, sum);
	part(cal + 1, index + 1, sum + index);
}
 
main(){
	while(1){
		scanf("%d %d", &n , &s);
		if (n==0 && s==0) return 0;
		i = 0;
		part(0, 0, 0);
		printf("%d\n",i);
	}
	return 0;
}