n, m = map(int, input().split()) a = list(map(int, input().split())) if m == 1: print("1") exit() cnt = {} for i in range(n): x = a[i] % m cnt[x] = cnt.get(x, 0) + 1 ans = 0 used = {} for x in cnt.keys(): y = m - x if not used.get(x, None) is None or not used.get(y, None) is None: continue used[x] = True used[y] = True if x == y: ans += 1 else: ans += max(cnt.get(x, 0), cnt.get(y, 0)) print(ans)