from collections import defaultdict N,M = map(int,input().split()) A = list(map(int,input().split())) seen = defaultdict(bool) cnt = defaultdict(int) ans = 0 for a in A: cnt[a%M] += 1 keys = list(cnt.keys()) for key in keys: if key == 0: ans += 1 continue if seen[key]: continue inv = M - key if key == M //2 and M % 2 == 0: ans += 1 else: ans += max(cnt[key],cnt[inv]) seen[key] = True seen[inv] = True print(ans)