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

  n_s, s_s = l.split " "
  n = n_s.to_i
  s = s_s.to_i

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

  puts count
end