n,m=map(int,input().split()) a=list(map(int,input().split())) ans=0 d=[0]*m for i in range(n): b=a[i]%m d[b]+=1 if d[0]: ans+=1 for i in range(1,(m//2)+1): if d[i]>=d[m-i]: ans+=d[i] else: ans+=d[m-i] if m%2==0: if d[m//2]: ans-=(d[m//2]-1) print(ans)