while str = gets
  break if str == nil
  data = str.split(" ").map{|e|
    e.to_i
  }
  n = data[0]
  s = data[1]
  res = 0

  perm = [0,1,2,3,4,5,6,7,8,9].permutation(n).to_a.each{|arr|
    v = 0
    for i in 1..n
      v += arr[i-1] * i
    end
    res += 1 if v == s
  }

  puts res
end