#include<iostream>
using namespace std;
int ans, s, n;
void solve(int i, int sum, int n)
{
	if (sum == s&&!n)
	{
		ans++;
		return;
	}
	if (i = 10 || !n)return;
	solve(i + 1, sum, n);
	solve(i + 1, sum + i, n - 1);
}
int main()
{
	while (cin >> n >> s, n != 0 || s != 0)
	{
		ans = 0;
		solve(0, 0, n);
		cout << ans << "\n";
	}
	return 0;
}