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

  result = 0
  (0..9).step do |i|
    # next if queue.include?(i)
    queue << i
    # if black_list.include?(queue.sort)
    #   queue.pop
    #   next
    # end
    # black_list << queue.sort
    result += count(limit, max, result, 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