#include <iostream>
using namespace std;

int cnt;

void choose(int n, int k, int digit) {
  if(n == 0 && k == 0) { cnt++; return; }
  else if (n <= 0) return;
  else if (k == 0) return;
  else if (digit >= 10) return;
  
  choose(n-digit, k-1, digit+1);
  choose(n, k, digit+1);
}

int main () {
  int n, ans, res;

  while(cin>>n>>ans, n|ans) {
    res = 0; cnt = 0;
    choose(ans, n, 0);
    cout << cnt << endl;
  }
  return 0;
}