N,M = map(int,input().split()) A = list(map(int,input().split())) dict = {} for i,v in enumerate(A): tmp =v%M if tmp not in dict: dict[tmp] = 1 else: dict[tmp]+=1 tmp = [] for i,v in dict.items(): tmp.append([v,i]) tmp.sort() tmp.reverse() #print(tmp) ans = 0 #print(dict) for i,v in enumerate(tmp): a,b = v[0],v[1] if b*2 == M: ans+=1 else: #print("a=",a,"b=",b) #print("dict[b]",dict[b]) ans+=dict[b] if (M-b) in dict: dict[M-b] = 0 print(ans)