
import std.stdio;
import std.conv;
import std.string;
import std.algorithm;

int table[1 << 10];
int ans;

// n 残りの残数
// s 合計
// bit mask
void solve(int mask, int n, int s) {
  if (table[mask] != 0) return;
  if (s == 0 && n == 0) {
    table[mask] = 1;
    ans++;
    return;
  }
  if (s < 0 || n <= 0) return;
  int sum = 0;
  for (int i = 0; i <= 9; i++) {
    if (((mask >> i) & 1) == 0) {
      solve(mask | 1 << i, n - 1, s - i);
    }
  }
  return;
}

void main() {
  while(true) {
    (cast(ubyte*)&table)[0..table.sizeof] = 0;
    auto line = readln.chomp.split(" ").map!(to!(int));
    int n = line[0];
    int s = line[1];
    if (n == 0 && s == 0) break;
    ans = 0;
    solve(0, n, s);
    writeln(ans);
  }
}