N,M = map(int,input().split()) A = list(map(int,input().split())) D = {} for i in range(M): D[i] = 0 for i in range(N): D[A[i] % M] += 1 ans = 0 for i in range(1,M//2+1): if i == M-i: if D[i]: ans += 1 else: ans += max(D[i],D[M-i]) #print(i,ans) if D[0]: ans += 1 print(ans) #print(D)