#include <cstdio>

using namespace std;

int count(int n, int s, int begin) {
  if (n == 1) { return begin <= s && s <= 9 ? 1 : 0; }
  if (9 - begin < n) { return 0; }
  if (n * (begin + n - 1) / 2 > s) { return 0; }
  int acc = 0;
  for (int i = begin; i <= 9 && i * 2 < s; ++i) {
    acc += count(n - 1, s - i, i + 1);
  }
  return acc;
}

int main() {
  while (true) {
    int n, s;
    scanf("%d %d", &n, &s);
    if (n == 0 && s == 0) { break; }
    printf("%d\n", count(n, s, 0));
  }

  return 0;
}