#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	int N, S;
	vector<int> v(10);
	for (int i = 0; i < 10; i++) {
		v.at(i) = i;
	}

	while (cin >> N >> S) {
		if (N == 0 && S == 0) {
			break;
		}

		int cnt = 0;
		for (int tmp = 0; tmp < (1 << 10); tmp++) {
			bitset<10> bs(tmp);

			if (bs.count() == N) {
				int sum = 0;
				for (int i = 0; i < 10; i++) {
					if (bs.test(i)) sum += i;
				}

				if (sum == S) cnt++;
			}
		}

		cout << cnt << endl;
	}
}
