#include <iostream>
using namespace std;

int solve(int i, int n, int s) {
  if(n == 0 && s == 0) return 1;
  if(i > 9 || n < 0 || s < 0) return 0;

  return solve(i + 1, n -1, s - i) + solve(i + 1, n , s);
}

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

  return 0;
}

