#include<cstdio>
#include<iostream>
using namespace std;
int n,s;
int func(int num, int cnt, int sum) {
	if(num > 9) return 0;
	if(cnt == n) {
		if(sum == s) return 1;
		return 0;
	}
	return func(num+1,cnt+1,sum + num) + func(num+1,cnt,sum);
}
int main() {
	while(cin >> n >> s,(n|s)) {
		printf("%d\n",func(0,0,0));
	}
	return 0;
}