#include <iostream>
#include <queue>
using namespace std;

int res;
const int d[10]={0,1,2,3,4,5,6,7,8,9};

void dfs(int now,int idx,int n,int sum,int s){
	if(now==n) {
		if(sum==s){
			res++;
		}
	}
	if(idx<10){
		dfs(now,idx+1,n,sum,s);
		dfs(now+1,idx+1,n,sum+d[idx],s);
	}
}

int main(){
	int n,s;
	queue<int> que;
	while(cin>>n>>s,n||s){
		res=0;
		dfs(0,0,n,0,s);
		que.push(res);
	}

	while(que.size()){
		cout<<que.front()<<endl;
		que.pop();
	}

	return 0;
}