from collections import defaultdict N,M=map(int,input().split()) A=list(map(int,input().split())) D=defaultdict(int) for a in A: D[a%M]+=1 X=0 K=list(D.keys()) for a in K: b=(M-a)%M X+=max(D[a],D[b]) D[a]=D[b]=0 print(X)