$a = 0
def f(i, n, s)
  if n == 0
    $a += 1 if $u == s
    return
  end
  return if i == 10
  f(i+1, n, s)
  f(i+1, n-1, s+i)
end

while true
  n, $u = gets.split.map(&:to_i)
  break if n == 0 && $u == 0
  f(0, n, 0)
  puts $a
end