arr = Array.new
until (line = gets) == "0 0\n"
  arr << line 
end
arr.each do |i|
  count = 0
  a = i.split(" ")
  n = a[0].to_i
  s = a[1].to_i
  (0..9).to_a.combination(n) do |a| 
    if s == a.inject{|result, item| result + item} 
      count += 1
    end
  end
  puts count
end