#include <iostream>
using namespace std;

int main()
{
	int n,s;
	while(cin>>n>>s,n)
	{
		int ans=0,comb=(1<<n)-1;
		while(comb<1<<10)
		{
			int tmp=0;
			for (int i = 0; i < 10; ++i)
			{
				if(comb>>i&1) tmp+=i;
			}
			if(tmp==s) ans++;
			int x=comb&-comb,y=comb+x;
			comb=((comb&~y)/x>>1)|y;
		}
		cout<<ans<<endl;
	}
	return 0;
}