#define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;


int a(int n, int s, int f) {
	int cnt = 0;
	if (n > 2)
		for (int i = f; i <= 9; i++) {
			if (s - i > i)cnt+=a(n-1,s-i,i+1);
			else break;
		}
	else if (n == 2)
		for (int i = f; i <= 9; i++) {
			if (s - i <= 9 && s - i > i)cnt++;
			else break;
		}

	return cnt;
}

int main() {
	for (int n, s; cin >> n >> s && (n || s);)
		cout << a(n, s, 0) << endl;

	return 0;
}