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

int n, s, res = 0, w = 1;
int a[10] = { 0 };

void dfs(int sum, int cnt) {
	if (cnt == n) {
		if (sum == s) {
			res++;
		}
	}
	for (int i = 0; i < 10; i++) {
		if (a[i] == 0) {
			a[i] = 1;
			dfs(sum + i, cnt + 1);
			a[i] = 0;
		}
	}
	return;
}

int main() {
	while (1) {
		res = 0; w = 1;
		cin >> n >> s;
		if (n == 0 && s == 0) return 0;
		dfs(0, 0);
		for (int i = 1; i <= n; i++) {
			w *= i;
		}
		cout << res / w << endl;
	}
	return 0;
}