#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int n,s;
	while(cin>>n>>s,n||s){
		if(n>10||s>45){
			cout<<0<<endl;
			continue;
		}
		int min = (int)pow(10.0,n-2);
		int lim = (int)pow(10.0,n);
		stack<int> st;
		vector<int> res;
		vector<bool> vis(lim,false);
		st.push(0);
		vis[0]=true;
		while(!st.empty()){
			int top = st.top();
			int tmp=top;
			int cur=0;
			while(tmp>0){
				cur+=tmp%10;tmp/=10;
			}
			st.pop();
			if(top>min&&cur==s){
				res.push_back(top);
			}else{
				if(top*10>=lim) continue;
				for(int i=top%10+1;i<10;++i){
					if(!vis[top*10+i]){
						vis[top*10+i]=true;
						st.push(top*10+i);
					}
				}
			}
		}
		cout<<res.size()<<endl;
	}
	return 0;
}