from collections import * N, M = map(int, input().split()) A = list(map(int, input().split())) D = defaultdict(int) for a in A: D[a % M] += 1 D[M - a % M] += 0 ans = 0 for k, v in D.items(): ans += max(D[k], D[M - k]) if M % 2 == 0: ans -= D[M//2] * 2 ans += min(1, D[M//2]) * 2 print(ans // 2)