#include <bits/stdc++.h>
using namespace std;

int dfs(int i, int s, int n){ // ???????????°????????????????????????????????¨????????°
  int ans = 0;
  if(i==10){
    if(s == 0 and n == 0) 
      return 1;
    else 
      return 0;
  }
  ans += dfs(i+1,s-i,n-1); // ??????
  ans += dfs(i+1,s  ,n  ); // ????????????
  return ans;
}


int main(){
  int s,n;
  while(1){
    cin >> n >> s;
    if(!s and !n) break;
    cout << dfs(0,s,n) <<  endl;
  }
}