N, X = gets.split.map(&:to_i) C = Array.new(10 ** 5 + 1, 0) A = gets.split.map(&:to_i) A.each do |a| C[a] += 1 end ans = (0 .. C.size).inject(0) do |s, i| break s if i > X - i next s if X - i >= C.size if i != X - i s + C[i] * C[X - i] * 2 else s + C[i] ** 2 end end puts ans