N,M = map(int,input().split()) A = list(map(int,input().split())) D = {} for i in range(N): if A[i] % M not in D: D[A[i] % M] = 0 D[A[i] % M] += 1 ans = 0 S = set() for k,v in D.items(): if k == M-k: ans += 1 elif k == 0: ans += 1 else: if k not in S: if M-k in D: ans += max(D[k],D[M-k]) S.add(M-k) else: ans += D[k] print(ans) #print(D)