#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int t = (n + 1) / 2;
  int a[n + 1], cnt[k + 1];
  for (int i = 1; i <= k; i++) {
    cnt[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  int s = 0;
  for (int i = 1; i <= k; i++) {
    if (cnt[i] >= 2 && t >= cnt[i] / 2) {
      s += (cnt[i] / 2 * 2);
      t -= cnt[i] / 2;
      cnt[i] %= 2;
      if (t == 0) {
        cout << s << endl;
        return 0;
      }
    }
  }
  if (t > 0) {
    cout << s + t << endl;
  }
  return 0;
}
