loop do
  n, s = gets.chomp.split(" ").map(&:to_i)
  exit if [n, s] == [0, 0]
  cnt = 0
  if s > 45
    puts 0
    next
  else
    [*0..9].combination(n).to_a.each do |i|
      cnt += 1 if i.inject(&:+) == s
    end
  end
  puts cnt
end