#include <bits/stdc++.h>
using namespace std;
const int N = 1003;
vector<int> v;
int a[N];
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  n = (n + 1) / 2;
  for (int i = 1; i <= k; i++) v.push_back(a[i]);
  sort(v.begin(), v.end());
  int ans = 0;
  for (int i = v.size() - 1; i >= 0; i--) {
    n -= v[i] / 2;
    ans += 2 * (v[i] / 2);
  }
  for (int i = 0; i < v.size(); i++)
    if (n > 0 && v[i] > 0) ans++, n--;
  cout << ans;
  return 0;
}
