import sys input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) INF = 2 ** 63 - 1 mod = 998244353 from collections import Counter n, m = mi() a = li() C = Counter() for v in a: C[v % m] += 1 ans = 0 s = set() for c, v in C.items(): if c in s: continue if m % 2 == 0 and c == m // 2: s.add(m // 2) ans += min(v, 1) else: if v > C[m - c]: s.add(c) ans += v else: s.add(m - c) ans += C[m - c] print(ans)