from collections import defaultdict N, M = map(int, input().split()) A = list(map(int, input().split())) r = defaultdict(int) for i in range(N): r[A[i] % M] += 1 ans = 0 if 0 in r: ans += 1 if M % 2 == 0 and (M // 2 in r): ans += 1 for i in range(1, (M - 1) // 2 + 1): ans += max(r[i], r[M - i]) print(ans)