N,M = map(int,input().split()) A = list(map(int,input().split())) from collections import defaultdict d = defaultdict(int) for a in A: d[a % M] += 1 ans = N tmp = 0 for a,v in d.items(): if a == 0: ans -= v - 1 continue elif M % 2 == 0 and a == M // 2: ans -= v - 1 elif M - a in d: u = min(v,d[M - a]) tmp += u print(ans - tmp // 2)