import sys input = sys.stdin.readline from collections import Counter N,M=map(int,input().split()) A=list(map(int,input().split())) X=Counter() for a in A: X[a%M]+=1 ANS=0 USE=set() for x in X: #print(x,USE) if x!=M/2 and x!=0 and not(x in USE): y=M-x ANS+=max(X[x],X[y]) USE.add(x) USE.add(y) elif x==M/2: ANS+=1 elif x==0: ANS+=1 print(ANS)