#include <iostream>
using namespace std;

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

int main(){
	int n,s;
	
	while(cin>>n>>s,n||s){
		res=0;
		dfs(0,0,n,0,s);
		cout<<res<<endl;
	}
	
	return 0;
}
a
void dfs(int now,int idx,int n,int sum,int s){
	if(now==n&&sum==s) {
		res++;
		return true;
	}
	
	if(dfs(now,idx+1,n,sum,s)) return true;
	
	if(dfs(now+1,idx+1,n,sum+d[idx],s)) return true;
	
	if(idx>9) return false;
	
	return false;
}