def count(n, s, i, arr, count_num)
  if arr.size == n
    count_num += 1 if s == arr.inject(:+)
    return count_num
  end

  i.upto(9) do |j|
    arr.push(j)
    count_num = count(n, s, j+1, arr, count_num)
    arr.pop
  end
  return count_num
end

while gets
  n,s = $_.split(' ').map(&:to_i)
  break if n == 0 && s == 0

  puts count(n, s, 0, [], 0)
end