#include <iostream>
using namespace std;
int n, s, sum = 0;
void f(int*,int);

int main() {
	while (1) {
		cin >> n >> s;
		if (n == 0 && s == 0)
			break;
		int *a;
		a = new int[n];
		f(a, 0);
		cout << sum << endl;
		sum = 0;
		delete[] a;
	}
	return 0;
}

void f(int *a, int x) {
	if (x == 0)
		a[0] = 0;
	else
		a[x] = a[x - 1] + 1;
	if (x == n - 1) {
		for (; a[x] < 10; a[x]++) {
			int y = 0;
			for (int i = 0; i < n; i++) {
				y += a[i];
				//cout << a[i] << " ";
			}
		//	cout << endl;
			if (y == s)
				sum++;
		}
		return;
	}
	for (; a[x] <= 10 - n + x; a[x]++)
		f(a, x + 1);
	return;
}

