def count(limit, max, n, queue, black_list)
  if queue.size == limit
    return queue.inject(:+) == max ? 1 : 0
  end

  result = 0
  (n..9).step do |i|
    queue << i
    result += count(limit, max, i + 1, queue, black_list)
    queue.pop
  end
  result
end

def bfs
  while gets
    limit, max = $_.split.map(&:to_i)
    break if limit == 0 && max == 0
    puts count(limit, max, 0, [], [])
  end
end

bfs