num = (0..9).to_a
while true do
  l = gets.chomp
  if l == "0 0" then
    exit
  end

  n, s = l.split(" ").map{|x| x.to_i}

  count = 0
  num.combination(n).each do |arr|
    if arr.inject(:+) == s then
      count += 1
    end
  end

  puts count
end