#include<cstdio>
#define REP(i,a,n) for(int i = 0;i < n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
void func(int num);
int in(){int n;scanf("%d",&n); return n;};
 
int flag[10] = {0};
int num2,ans;
int main(void){
 while(1){
  ans = 0;
  int num = in(); num2 = in();
  if(num == 0 && num2 == 0) break;
  func(num);
  printf("%d\n",ans);
 }
 return 0;
}
 
void func(int num){
 if(num == 0){
  int n = 0;
  rep(i,10){if(flag[i]) n+= i;}
  if(n == num2) ans++;
  return;
 }
 rep(i,10){
  if(flag[i] == 1) return;
  flag[i] = 1;
  func(num-1);
  flag[i] = 0;
 }
 return;
}