from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,pprint,fractions sys.setrecursionlimit(10**8) mod = 998244353 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_1(): return list(map(lambda x:int(x)-1, sys.stdin.readline().split())) def inplm(): return map(int, sys.stdin.readline().split()) def inpl_1m(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) def err(x): print(x); exit() def sol(n,m,a): res = 0 for it in itertools.product([0,1],repeat=n): if sum(it) == 0: continue b = [] for i,x in enumerate(it): if x: b.append(a[i]) ln = len(b) ok = 1 for i in range(ln): for j in range(i+1,ln): if (a[i] + a[j])%m: ok = 0 if ok: res = max(res, ln) return res n,m = inpl() a = inpl() d = defaultdict(int) for x in a: d[x%m] += 1 res = n seen = set() for key in list(d): if key in seen: continue if key == 0 or key == m-key: res -= d[key]-1 seen.add(key) else: seen.add(key) seen.add(m-key) res -= min(d[key], d[m-key]) print(res)