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: ans+=1 else: ans+=max(CA[k%M],CA[M-k%M]) print(ans//2)