#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int cnt = 0;
// n := ???????????????????????°????????° s := ?????????????¨? now := ?????¨?????????????????°???
void dfs(int n, int s, int now){
	if(now > 9){
		//n??????????????????????¨?s
		if(n == 0 && s == 0) cnt++;
		return;
	}
	dfs(n - 1, s - now, now + 1);//??°???now???????????????
	dfs(n, s, now + 1);//??°???now??????????????????
	return;
}
int main(void){
	while(1){
		int n, s; cin >> n >> s;
		if(n == 0 && s == 0) return 0;
		cnt = 0;
		dfs(n, s, 0);
		printf("%d\n", cnt);
	}
}