#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define Rep(i,a,n) for(int i=(int) a;i<(int) n;i++) #define ALL(a) a.begin(),a.end() #define Upper(a,n) upper_bound(((vector)a).begin(), (a).end(),(int) n) - a.begin(); #define Lower(a,n) lower_bound(((vector)a).begin(), (a).end(),(int) n) - a.begin(); using namespace std; using ll = long long; using ld = long double; typedef pair PLL; typedef pair PII; long long INF = 9223372036854775807; int dx[4] = { 0,1,0,-1 }; int dy[4] = { 1,0,-1,0 }; string EIKO = "abcdefghijklmnopqrstuvwxyz"; template T gcd(T a, T b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } ll Pow(ll a, ll n) { if (n == 0) return 1; if (n == 1) return a; if (n % 2 == 1) return (a * Pow(a, n - 1)); ll t = Pow(a, n / 2); return (t * t); } ll U = Pow(10, 9) + 7; template ll kuraiwa(T n) { int x = 0; ll y = 0; while (n != 0) { y += (n % 10); n /= 10; x++; } return y; } template long long modPow(T a, T n, T p) { if (n == 0) return 1; if (n == 1) return a % p; if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p; long long t = modPow(a, n / 2, p); return (t * t) % p; } template vector bittify(T n) { vector a; while (n != 0) { int s = n % 2; a.push_back(s); n /= 2; } return a; } template ll sinsuu(T xyz, T yzx, T abc) { ll b = 0, h = 0; while (abc != 0) { int g = abc % 10; abc /= 10; b += g * Pow(xyz, h); h++; } if (yzx == 10) { return b; } ll c = 0; h = 0; while (b != 0) { c += (b % yzx) * Pow(10, h); h++; } return c; } template bool sosuu(T x) { for (int i = 2; i * i <= x;i++) { if (x % i == 0) return false; } return true; } template vector bunnkai(T x) { vector a; ll n = 2; while (x != 1) { while (x % n == 0) { a.push_back(n); x /= n; if (x == 1) break; } if (n >= sqrt(x)) break; n++; } if (x != 1) a.push_back(x); return a; } template vector yakusuu(T x) { vector a; for (ll i = 1; i * i <= x; i++) { if (x % i == 0) { a.push_back(i); if (i != x / i) { a.push_back(x / i); } } } sort(ALL(a)); return a; } template unsigned int factorial(T n) { unsigned int ans; ans = 1; for (unsigned int i = 2; i <= n; i++) { ans *= i; } return ans; } int main() { ll n, m; cin >> n >> m; vectora(n); rep(i, n)cin >> a[i]; map S; rep(i, n) { a[i] %= m; S[a[i]]++; } int ans = n; for (auto i : S) { if (i.first == 0 and i.second >= 2) ans -= i.second - 1; else if (i.first * 2 < m) { if (S[m - i.first] > 0) { ans -= min(i.second, S[m - i.first]); } } else if (i.first * 2 == m) ans -= i.second - 1; } cout << ans << endl; }