#include <stdio.h>

int sum[10][46]={0};
int main() {
	for(int i=0; i<1<<10; i++) {
		int sumi = 0, count = 0;
		for(int j=0; j<10; j++) {
			if(i & (1<<j)) {
				sumi += j;
				count++;
			} 
		}
		sum[count][sumi]++;
	}
	
	int n = -1, s = -1;
	if(freopen("D:\\test.txt", "r", stdin) == NULL) return -1;
	while(scanf("%d%d", &n, &s) !=EOF) {
		if(n == 0 && s == 0) break;
		printf("%d\n", sum[n][s]);
	}
	return 0;
}