#include #define rep(i,n) for(int i = 0; i < (int)(n); i++) using namespace std; using LL = long long; int main(){ int N; LL M; cin >> N >> M; vector A(N); rep(i,N) cin >> A[i]; rep(i,N) A[i] %= M; map mp; rep(i,N) mp[A[i]]++; int ans = 0; for(auto itr : mp){ LL a1 = itr.first; LL a2 = (M - a1) % M; if(a1 == a2) ans += 2; else ans += max(mp[a1], mp[a2]); } cout << ans / 2 << endl; return 0; }