#include<iostream>

using namespace std;

int ans,n,s;
int nums[10];

void search(int num,int t)
{
	if(num>9)
		return;
	int sum;
	if(t==n)
	{
		for(int i=0;i<num+1;i++)
			sum+=nums[i]*i;
		if(sum==s)
			ans++;
		return;
	}
	nums[num+1]=0;
	search(num+1,t);
	nums[num+1]=1;
	search(num+1,t+1);
	return;
}

int main()
{
	
	for(;;)
	{
		cin >> n >> s;
		if(n==0 && s==0)
			break;
		ans=0;
		search(0,0);
		cout << ans << endl;
	}
}