#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int ans, sum;
void dfs(int i, int s, int n){
	/*cout << "i = " << i;
	cout << " s = " << s;
	cout << " n = " << n << endl;*/
	if(s == sum && n == 0){
		ans++;
		return;
	}
	if(i == 10 || n == 0) return;
	dfs(i+1, s+i, n-1);
	dfs(i+1, s, n);

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

	return 0;
}