import collections N,M = map(int, input().split()) A = list(map(int, input().split())) CA = collections.Counter() for a in A: CA[a%M]+=1 CA[M-a%M]+=0 ans = 0 for k,v in CA.items(): if k*2==M or k==0: ans+=2 elif k==M: pass else: ans+=max(CA[k],CA[M-k]) print(ans//2)