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 for i in range(M // 2 + 1): ans += max(r[i], r[M - i]) print(ans)