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

int num_count, sum;

void dfs(int i, int s, int n) {
  if (s == sum && n == 0) {
    num_count++;
    return;
  }

  if (i == 10 || n == 0) {
    return;
  }

  dfs(i + 1, s + i, n - 1);
  dfs(i + 1, s, n);
}


int main(void) {
  int i, n;

  while (true) {
    cin >> n >> sum;
    if (n == 0 && sum == 0) break;

    num_count = 0;
    dfs(0, 0, n);
    cout << num_count << endl;
  }

  return 0;
}