from collections import defaultdict def get_list(ty=int): return list(map(ty, input().split())) def get_int(): return int(input()) def get_str(): return input() N, M = get_list() A = get_list() cnt = defaultdict(int) for a in A: cnt[a % M] += 1 ans = 0 if cnt[0] > 0: ans += 1 keys = cnt.keys() used = {0} for k in list(keys): if not k in used: used.add(k) k2 = M-k used.add(k2) ans += max(cnt[k], cnt[k2]) print(ans)