#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printv(vector<T> v) {
  for (auto e : v) {
    cout << e << " ";
  }
  cout << "\n";
}
template <typename T>
void printvv(vector<T> vv) {
  for (long long i = 0; i < vv.size(); i++) {
    cout << i << ": ";
    for (auto e : vv[i]) {
      cout << e << " ";
    }
    cout << "\n";
  }
}
long long t, n, m, k, x, y;
vector<long long> a, b, c;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  a.resize(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<long long> d(k + 1);
  for (long long i = 0; i < n; i++) {
    d[a[i]]++;
  }
  long long ans = 0;
  long long rem = 0;
  for (long long i = 1; i <= k; i++) {
    ans += 2 * (d[i] / 2);
    rem += d[i] % 2;
  }
  ans += rem / 2;
  ans += rem % 2;
  cout << ans << "\n";
}
