#include <iostream>
#include <algorithm>
using namespace std;

int main(){
  int n,s;
  while(cin >> n >> s, n+s){
    bool arr[10];
    for(int i=0; i<n; i++)
      arr[9-i] = 1;
    for(int i=n; i<10; i++)
      arr[9-i] = 0;
    int c = 0;
    do{
      int S = 0;
      for(int i=0; i<10; i++){
	if(arr[i]) S+= i;
      }
      if(S == s) c++;
    }while(next_permutation(arr,arr+10));
    cout << c << endl;
  }
  return 0;
}