#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	int n,s;
	while(scanf("%d %d",&n,&s)==2,n||s){
		int mat[10] = {0,1,2,3,4,5,6,7,8,9};
		int t = 0;
		map<vector<int>,int> table;
		do{
			vector<int> tmp;
			int sum = 0;
			for(int x=0;x<n;++x){
				tmp.push_back(mat[x]);
				sum += mat[x];
				if(sum>s)break;
			}
			if(sum==s){
				sort(tmp.begin(),tmp.end());
				table[tmp] = 100;
			}
		}while(next_permutation(mat,mat+9));
		cout<<table.size()<<endl;
	}
	return 0;
}