zero_nine = (0..9).to_a
while gets
  n,s = $_.chomp.split.map{|x| x.to_i}
  break if n == 0 && s == 0
  count = 0
  zero_nine.combination(n) do |x|
    count += 1 if x.reduce{|sum,p| sum+p} == s
  end
  puts count
end