n,m = map(int,input().split()) dic = {} A = list(map(int,input().split())) for a in A: dic[a%m] = dic.get(a%m,0) + 1 ans = 0 done = set() for key,value in dic.items(): if key in done: continue if key == 0: ans += 1 continue if m-key in dic: if m-key == key: ans += 1 else: val2 = dic[m-key] ans += max(value,val2) done.add(m-key) else: ans += value print(ans)