#include<string>
#include<vector>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)




vector<int>v(10,0);
int n,s,c=0;

void f(int i,int sum,int t){

if(t==n){
if(sum==s) c++;
else return;
}
else{

v[i]=1;
sum+=i;
t++;

REP(j,i+1,9)
if(v[j]==0) f(j,sum,t);

}
}

int main(){

while(true){

cin >> n >> s;
if(n==0 && s==0) break;


rep(i,10-n) f(i,0,0);

cout << c << endl;

vector<int>v(10,0);
c=0;

}

	return 0;
}