#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
inline long long read() {
  long long num = 0, flag = 1;
  char c = ' ';
  for (; c > '9' || c < '0'; c = getchar())
    if (c == '-') flag = -1;
  for (; c >= '0' && c <= '9';
       num = (num << 1) + (num << 3) + c - 48, c = getchar())
    ;
  return num * flag;
}
long long a[100005], num[100005];
signed main() {
  long long n = read(), k = read();
  for (long long i = (1); i <= (n); i++) a[i] = read(), num[a[i]]++;
  sort(a + 1, a + 1 + n);
  long long ans = 0, maxi = (n + 1) / 2;
  for (long long i = (1); i <= (k); i++) {
    while (num[i] >= 2) {
      ans += 2;
      num[i] -= 2;
      maxi--;
    }
  }
  for (long long i = (1); i <= (k); i++) {
    if (num[i] && maxi) {
      ans++;
      maxi--;
    }
  }
  cout << ans << endl;
  return 0;
}
