#include <iostream>
using namespace std;

int n, s, value[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ans;

void dfs(int i, int count, int sum)
{
	if (n == count) {
		if (0 == sum) ans++;
	}else if (i >= 0) {
		dfs(i-1, count, sum);
		dfs(i-1, count+1, sum - value[i]);
	}
}
int main(void)
{
	while (cin >> n >> s) {
		if (n == 0 && s == 0) break;
		ans = 0;
		dfs(9, 0, s);
		cout << ans << endl;
	}
	
	return 0;
}