#include <iostream>

using namespace std;

int judge(int number, int sum, int counter) {
	if (sum == 0 && number == 0) {
		return 1;
	} else if ((sum > 0 && number == 0) || (number >= 2 && sum <= 0) || counter < 0){
		return 0;
	} else {
		if (counter > sum) {
			return judge(number, sum, counter-1);
		} else {
			return judge(number-1, sum-counter, counter-1)+judge(number, sum, counter-1);
		}
	}
}

int main() {
	int n,s;
	while (cin >> n >> s) {
		if (n == 0 && s == 0) {
			break;
		}
		cout << judge(n,s,9) << endl;
	}
	return 0;
}