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 elif M - a in d: u = min(v,d[M - a]) tmp += u if M % 2 == 0 and M // 2 in d: v = d[M // 2] ans += 1 print(ans - tmp // 2)