n, m = map(int, input().split()) A = list(map(int, input().split())) A.sort() cnt = {} for a in A: a %= m cnt[a] = cnt.get(a, 0) + 1 keys = list(cnt.keys()) ans = 0 for k in keys: if k not in cnt: pass elif k == 0: ans += 1 elif k * 2 == m: ans += 1 elif m - k in cnt: ans += max(cnt[k], cnt[m - k]) del cnt[m - k] else: ans += cnt[k] print(ans)