#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); ll N, M; cin >> N >> M; vector A(N); rep(i, 0, N) cin >> A[i]; rep(i, 0, N) A[i] %= M; set s; map m; rep(i, 0, N) { s.insert(A[i]); m[A[i]]++; } ll ans = 0; set seen; for (ll i : s) { if (seen.count(i)) continue; if (i == 0) { ans++; continue; } seen.insert(i); if (s.count(M - i)) { ans += max(m[i], m[M - i]); seen.insert(M - i); } else { ans += m[i]; } } cout << ans << '\n'; }