#include<iostream>
#include<cstdio>
using namespace std;
int n,s,count,c;

int solve(int i,int sum,int used){
	if(i==10){
		if(s==sum&&used==n){
			
		 count++;c++;
		}
		return count;
	}

	solve(i+1,sum+i,used+1);
	
	solve(i+1,sum,used);
	
	
	return count;
}

int main(){
	
	while(cin>>n>>s,n&&s){
	count=0;c=0;
	solve(0,0,0);
	cout<<c<<endl;
	}

return 0;
}