// 2014/09/12 Tazoe

#include <iostream>
using namespace std;

int DFS(int n, int s, int m)
{
	if(n==0 && s==0)
		return 1;
	else if(n<=0)
		return 0;
	else if(s<=0)
		return 0;
	else if(m>9)
		return 0;

	int cnt = 0;

	cnt += DFS(n-1, s-m, m+1);
	cnt += DFS(n, s, m+1);

	return cnt;
}

int main()
{
	while(true){
		int n, s;
		cin >> n >> s;

		if(n==0 && s==0)
			break;

		cout << DFS(n, s, 0) << endl;
	}

	return 0;
}