#include #include #include #include #include #include #include #include #include #include #include "testlib.h" using namespace std; #define MOD 998244353 int main() { registerValidation(); long long N = inf.readLong((long long)1, (long long)100000, "N"); inf.readSpace(); long long M = inf.readLong((long long)1, (long long)1000000000000, "M"); inf.readEoln(); vector A(N); A[0] = inf.readLong((long long)1, (long long)1000000000000, "A1"); map Map2; Map2[A[0]]++; for (int i = 1; i < N; i++) { inf.readSpace(); A[i] = inf.readLong((long long)1, (long long)100000000000, "A"); Map2[A[i]]++; if (Map2[A[i]] > 1) cout << -1 << endl; } inf.readEoln(); inf.readEof(); map Map; set Set; for (int i = 0; i < N; i++) { Map[A[i] % M]++; Set.insert(A[i] % M); } long long count = 0; while (!Set.empty()) { long long a = *Set.begin(); Set.erase(Set.begin()); if (a == 0 || a * 2 == M) { count++; } else { count += max(Map[a], Map[M - a]); Map[a] = 0; Map[M - a] = 0; } } cout << count << endl; }