#include <bits/stdc++.h>

#define INF INT_MAX
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

class State{
public:
	int n;
	int sum;
	int lastnum;
	State(int nn,int s,int l):n(nn),sum(s),lastnum(l){};
};

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);

	int n,s;
	while(scanf("%d %d",&n,&s) != EOF && n != 0){
		vector<State> v;	//first:?????¨?????°,second:????¨????
		v.push_back(State(0,0,0));
		int ans = 0;
		while(v.size() > 0){
			int nn = v.back().n;
			int sum = v.back().sum;
			int lsn = v.back().lastnum;
			v.pop_back();
			if(nn == n){
				if(sum == s){
					ans++;
				}
				continue;
			}
			for(int i = lsn;i <= 9;i++){
				v.push_back(State(nn+1,sum+i,i));
			}
		}
		cout << ans << endl;
	}

	return 0;
}