#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 u = 0;

void solve(int i,int sum,int n,int s){
	if(sum==s && !n){
		++u;return;
	}
	if(i==10 || !n)return;
	solve(i+1,sum,n,s);
	solve(i+1,sum+i,n-1,s);
}

int main(){
	int n,s;
	while(scanf("%d %d",&n,&s)==2,n||s){
		u = 0;
		solve(0,0,n,s);
		cout<<u<<endl;
	}
	return 0;
}