#include <iostream>
using namespace std;

int n, s;

int dfs(int i, int sum, int rest) {
	if (rest < 0) return 0;
	if (i == 10) return (sum == s && rest == 0) ? 1 : 0;
	return dfs(i + 1, sum, rest) + dfs(i + 1, sum + i, rest - 1);
}

int main() {
	while (true) {
		cin >> n >> s;
		if (n == 0 && s == 0)
			break;
		cout << dfs(0, 0, n) << '\n';
	}
}
