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(): if k % M == 0: ans += min(1, D[k%M]) else: ans += max(D[k], D[M - k]) # print(ans, D) if M % 2 == 0: ans -= D[M//2] ans += min(1, D[M//2]) * 2 print(ans // 2)