#include using namespace std; int main() { int n; long long m; cin >> n >> m; vector a(n); map mp; for (int i = 0; i < n; i++) { cin >> a[i]; a[i] %= m; mp[a[i]]++; } long long ans = 0; bool ok1 = false; bool ok2 = false; map used; for (int i = 0; i < n; i++) { if (used[a[i]]) continue; if (a[i] * 2 == m) ok1 = true; else if (a[i] == 0) ok2 = true; else ans += max(mp[a[i]], mp[m - a[i]]); used[a[i]]++; used[m - a[i]]++; } ans += ok1 + ok2; cout << ans << endl; return 0; }