#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

typedef vector<int> P;
int main()
{
	int n, s;
	while (cin >> n >> s, n||s)
	{
		set<P> ans;
		P v;
		for (int i=0; i<10; i++)
			v.push_back(i);

		do
		{
			P t(v.begin(), v.begin()+n);
			int sum  = 0;
			for (int i=0; i<n; i++)
				sum += t[i];
			if (sum == s)
			{
				sort(t.begin(), t.end());
				ans.insert(t);
			}
		} while(next_permutation(v.begin(), v.end()));

		cout << ans.size() << endl;
	}
}