#include <iostream>
using namespace std;

int n,s;

int recursion(int sum,int num,int cnt){
  if(sum > s || cnt > n) return 0;
  if(cnt == n && sum == s) return 1;
  if(num > 9) return 0;
  int hoge = 0;
  hoge += recursion(sum+num,num+1,cnt+1);
  hoge += recursion(sum,num+1,cnt);
  return hoge; 
}

int main(){
  while(cin >> n >> s,n||s){
    cout << recursion(0,0,0) << endl;
  }
}