while (line = gets)
  n, s = line.chop.split(" ").map{|s| s.to_i}

  if n == 0 && s == 0
    break
  end

  digs = (0..9).map{|k| k}
  count = 0

  digs.combination(n) do |arr|
    if arr.inject{|s,i| s + i } == s
      count += 1
    end
  end

  puts count
end