# AOJ 0030 Sum of Integers

$n_combinations = Array.new(11) {Array.new(46, 0)}

def count(n = 1, s = 0, used = 0)
  (0..9).each do |i|
    used_i = 1 << i
    next if used & used_i > 0
    # 順序違いを数えない
    used |= used_i

    new_s = s + i
    $n_combinations[n][new_s] += 1

    count(n + 1, new_s, used) if n < 10
  end
end

count

while line = gets
  n, s = line.split.map {|v| v.to_i}
  break if n.zero? && s.zero?

  puts 0 unless 1 <= n && n <= 10 && 0 <= s && s <= 45

  puts $n_combinations[n][s]
end