#include <bits/stdc++.h>
using namespace std;
int freq[100005];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    freq[x]++;
  }
  int p = (n + 1) / 2;
  int count = 0;
  int left = 0;
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    p -= freq[i] / 2;
    ans += (freq[i] / 2) * 2;
    left += freq[i] % 2;
  }
  if (p) ans += p;
  cout << ans << endl;
  return 0;
}
