#include<stdio.h>
#include<algorithm>

int km(int m, int n, int s) { //m～9の数から異なるn個を引っ張ってsとなる組み合わせを出力
	int i = 0;
	int count = 0;

	if (n == 1) {
		if (m <= s && s <= 9) { count=1; }
	}
	else {
		for (i = m; i <= 8; i++) {
			count += km(i + 1, n - 1, s - i);
		}
	}
	return count;
}

int main(void) {
	int n = 0;
	int s = 0;
	while (true) {
		n = 0;
		s = 0;

		scanf("%d %d", &n, &s);
		if (n == 0 && s == 0) { break; }

		printf("%d\n", km(0, n, s));

		
	}
	return 0;
}
