#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); ll N,M; cin >> N >> M; map mp; rep(i,N) { ll a; cin >> a; mp[a % M]++; } ll ans = 0; vector v; for(auto [x, _] : mp) v.push_back(x); map visited; for(ll x : v) { if(visited.count(x)) continue; visited[x] = 1; visited[M - x] = 1; ans += max(mp[x], mp[M - x]); } cout << ans << endl; }