n,m=list(map(int,input().split())) seq=list(map(int,input().split())) cnt=0 am=[0]*m for i in range(len(seq)): sur=seq[i]%m am[sur]+=1 if am[0]>0: cnt+=1 if m%2==0: if am[int(m/2)]>0: cnt+=1 for i in range(1,int(len(am)/2)): cnt+=max(am[i],am[len(am)-i]) else: for i in range(1,int(len(am)/2)+1): cnt+=max(am[i],am[len(am)-i]) print(cnt)