#pragma region Macros #include #define rep(i, n) for (int i = 0; i < (n); ++i) using std::cin; using std::cout; using std::min; using std::max; using std::set; using std::map; using std::vector; using ll = long long; int main() { cin.tie(nullptr) -> sync_with_stdio(false); 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]]++; set s; rep(i, n) { ll x = a[i]; ll y = m-a[i]; s.insert(min(x, y)); } int ans = 0; for (ll x : s) { ll y = m-x; if (x == 0 or x == y) ans++; else ans += max(mp[x], mp[y]); } cout << ans << '\n'; return 0; }