#include <bits/stdc++.h>
using namespace std;
const long long mxn = 1e3 + 5;
const long long mxm = 1;
const long long INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const double eps = 1e-7;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return ans;
}
long long lowbit(long long x) { return (x & (-x)); }
long long cnt[mxn] = {0};
signed main(void) {
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    long long tmp;
    cin >> tmp;
    cnt[tmp]++;
  }
  long long ans = 0, used = 0;
  for (long long i = 1; i <= k; i++) {
    if (cnt[i] % 2 == 0) {
      ans += cnt[i];
      used += cnt[i] / 2;
      cnt[i] = 0;
    } else {
      if (cnt[i] >= 2) {
        used += cnt[i] / 2;
        ans += cnt[i] - 1;
        cnt[i] = 1;
      }
    }
  }
  long long tot = (n % 2 == 0 ? n / 2 : n / 2 + 1);
  for (long long i = 1; i <= k; i++) {
    if (used < tot && cnt[i]) {
      ans++;
      used++;
      cnt[i] = 0;
    }
  }
  cout << ans << endl;
}
