#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int ans,n,s;

void dfs(int nowsum,int k,int x)
{
	if (k == n)
	{
		if (nowsum == s)
		{
			ans++;
		}
		return;
	}

	if (x <= 9)
	{
		dfs(nowsum+x,k+1,x+1);
		dfs(nowsum,k,x+1);
	}
	return;
}

int main()
{
	while(1)
	{
		cin >> n >> s;
		if (n == 0 && s == 0) return 0;
		ans = 0;
		dfs(0,0,0);
		cout << ans << endl;
	}
	return 0;
}
