#include <iostream>
using namespace std;

/** Problem0030 : Sum of Integer **/
int cnt, ans;

void solve(int i, int s, int n)
{
	if (n==0 && s == ans) {
		cnt++;
		return;
	}
	
	if (n==0 || i>9)
		return;
	
	solve(i+1, s+i, n-1);
	solve(i+1, s, n);
}

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