// class point	の練習（クラスの高度な実装）
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>
#include <vector>
#include <queue>


typedef long long llong;
using namespace std;

int bitDP[10][110] = { 0 };

int main() {
	for (int i = 0; i < 1024; i++) {
		int present_num = 0;
		int present_i = i;
		int present_cnt = 0;
		int present_sum = 0;
		while (present_num != 10) {
			if (present_i % 2) {
				present_sum += present_num;
				present_cnt++;
			}
			present_num++;
			present_i = present_i >> 1;
		}
		bitDP[present_cnt][present_sum]++;
	}
	int n, s;
	while (1) {
		cin >> n >> s;
		if (n == 0)break;
		cout << bitDP[n][s] << endl;
		
	}
	
	return 0;
}
 
