while line = gets
  answer = 0
  n, s = line.chomp.split.map(&:to_i)

  [*0..9].permutation(n).each do |p|
    answer += 1 if p.each_with_index.inject(0) { |sum, (value, index)| sum + value * (index + 1) } == s
  end

  puts answer
end