#include #include using namespace std; using namespace atcoder; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = (int)(n); i >= 0; i--) #define all(v) v.begin(), v.end() #define mod1 1000000007 #define mod2 998244353 typedef long long ll; int main(){ ll N, M; cin >> N >> M; vector A(N); rep(i,N) cin >> A[i]; map mp; for (ll i = 0; i < N; i++){ mp[A[i] % M]++; } ll ans = 0; for (auto itr = mp.begin(); itr != mp.end(); itr++){ if (itr->first == 0){ ans += min(1LL, itr->second); } else{ if (M % 2 == 0 && itr->first == M / 2){ ans += min(1LL, itr->second); } else{ if (mp[M - itr->first] == 0){ ans += (itr->second); } else{ if (itr->first > M / 2) continue; else ans += max(itr->second, mp[M - (itr->first)]); } } } //cout << ans << endl; } cout << ans << endl; }