import sys from collections import defaultdict def main(): input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 M = int(input[idx]) idx += 1 A = list(map(int, input[idx:idx+N])) idx += N freq = defaultdict(int) for num in A: r = num % M freq[r] += 1 processed = set() ans = 0 # Handle residue 0 if 0 in freq: ans += 1 processed.add(0) # Process other residues for r in list(freq.keys()): if r in processed: continue if r == 0: continue s = (M - r) % M if r == s: # Self-complementary, e.g., M even and r = M/2 ans += 1 processed.add(r) elif s in freq: # Take the maximum of the two residues ans += max(freq[r], freq[s]) processed.add(r) processed.add(s) else: # Check if 2*r is a multiple of M if (2 * r) % M == 0: ans += 1 else: ans += freq[r] processed.add(r) print(ans) if __name__ == "__main__": main()