#include using namespace std; //#include //using namespace atcoder; using ll = long long; using P = pair; using Pll = pair; using Graph = vector>; #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i,n) for(ll i = 1; i <= (n); ++i) #define drep(i,n) for(ll i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (ll i = s; i < (t); ++i) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() void solve(){ ll n,m; cin >> n >> m; map mp; rep(i,n){ ll a; cin >> a; mp[a%m]++; } ll ans = 0; for(auto x : mp){ if(2*x.first%m == 0){ ans++; continue; } if(!mp.count((m-x.first)%m)){ ans += x.second; continue; } ll y = (m-x.first)%m; if(x.first > y) continue; ans += max(mp[x.first],mp[y]); } cout << ans << endl; } int main(void){ solve(); return 0; }