from collections import defaultdict N, M = map(int, input().split()) A = list(map(int, input().split())) dic = defaultdict(int) for a in A: dic[a % M] += 1 dic[M - a % M] += 0 ans = 0 for k, v in dic.items(): if k == 0: ans += min(1, dic[k]) elif k == M // 2: if M % 2 == 0: ans += min(1, dic[k]) else: ans += max(dic[k], dic[M - k]) elif k < M//2: ans += max(dic[k], dic[M - k]) if ans == 0: ans = 1 print(ans)