require "set" N, M = gets.split.map(&:to_i) A = gets.split.map { _1.to_i % M } count = Hash.new(0) A.each do |x| count[x] += 1 end ans = 0 A.map { |x| [x, M - x].min }.uniq.each do |x| if x * 2 == M ans += 1 else ans += [count[x], count[-x % M]].max end end puts ans