d = [0,1,2,3,4,5,6,7,8,9]
arr = [0, 9, 17, 24, 30, 35, 39, 42, 44, 45]
while input = gets
  n, s = input.split.map(&:to_i)
  break if n == 0 && s == 0
  if s > arr[n] then
    puts 0
  else
    count = 0
    d.combination(n).collect{|arr| arr.inject(:+)}.each{|i|
      count += 1 if i == s
    }
    puts count
  end
end