N, X = gets.split.map(&:to_i) a = gets.split.map(&:to_i) puts a.repeated_permutation(2).to_a.select { |ai, aj| ai + aj == X }.size