from collections import defaultdict n,m=map(int,input().split()) a=list(map(lambda x : int(x) % m,input().split())) d=defaultdict(int) for b in a: d[b]+=1 d[m-b] ans=0 for k in d.keys(): if k==0: continue ans+=max(d[k],d[m-k]) d[k]=d[m-k]=0 print(ans)