import sys input = sys.stdin.readline from collections import * N, M = map(int, input().split()) A = list(map(int, input().split())) cnt = defaultdict(int) for Ai in A: cnt[Ai%M] += 1 ans = 0 s = set() l = list(cnt.keys()) for k in l: if k in s: continue if k==0 or (M%2==0 and k==M//2): ans += min(1, cnt[k]) else: ans += max(cnt[k], cnt[M-k]) s.add(M-k) print(ans)