n, x=gets.split.map(&:to_i) a=gets.split.map(&:to_i) cnt=Array.new(a.max+1){0} a.each{|e| cnt[e]+=1} ans=0 a.each do |e| next if x-e<0 or x-e>=cnt.size ans+=cnt[x-e] end puts ans