#include <iostream>

using namespace std;

int n,s,count;

void dfs(int i,int sum,int num)
{
	if(num == n)
	{
		if(sum == s)
		{
			count++;
		}
		return;
	}
	if(i == 10)
	{
		return;
	}

	dfs(i+1,sum,num);
	dfs(i+1,sum+i,num+1);
}

int main()
{
	n,s;
	while(cin >> n >> s)
	{
		count = 0;
		if(n == 0 && s == 0)
		{
			break;
		}

		dfs(0,0,0);
		cout << count << endl;
	}
	return 0;
}