#include<iostream>
using namespace std;


int dfs(int a,int b,int c){
	if(b < 0)
		return 0;
	if(c < 0)
		return 0;
	if(a < 0)
		return 0;
	int n=0;
	if(b == 0 && a == 1){
		n++;
	}
	n =n + dfs(a-1,b-c,c-1) + dfs(a,b,c-1);
	return n;
}

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