import sys input = sys.stdin.readline from collections import * N, M = map(int, input().split()) A = list(map(int, input().split())) cnt = defaultdict(int) for Ai in A: cnt[Ai%M] += 1 ans = 0 for i in range(1, (M+1)//2): ans += max(cnt[i], cnt[M-i]) ans += min(1, cnt[0]) if M%2==0: ans += min(1, cnt[M//2]) print(ans)