import sys input = sys.stdin.readline from collections import defaultdict N,M=map(int,input().split()) A=list(map(int,input().split())) cnt=defaultdict(int) for a in A: cnt[a%M]+=1 ans=0 check = set() if cnt[0]>0: ans = 1 if M%2==0 and cnt[M//2]>0: ans += 1 check.add(M//2) check.add(0) keys = list(cnt.keys()) for i in keys: if i in check:continue if cnt[i] >= cnt[M-i]: ans += cnt[i] else: ans += cnt[M-i] check.add(i) check.add(M-i) print(ans)