n, v = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
c = gets.split.map(&:to_i)
d = gets.split.map(&:to_i)
ab = Hash.new(0)
a.each do |x|
  b.each do |y|
    ab[x + y] += 1
  end
end
cd = Hash.new(0)
c.each do |x|
  d.each do |y|
    cd[x + y] += 1
  end
end
ab_keys = ab.keys.sort
cd_keys = cd.keys.sort
answer = 0
ab_keys.each do |x|
  break if x > v
  y = cd_keys.bsearch {|y| x + y >= v }
  if y && x + y == v
    answer += ab[x] * cd[y]
  end
end
p answer
