N, X = gets.split.map &:to_i A = gets.split.map &:to_i h = A.group_by(&:itself).map{|k, v|[k, v.size]}.to_h p h.map{|k, v| v * (h[X - k] || 0) }.sum