#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, tmp;
  cin >> n >> k;
  vector<int> a;
  for (int i = 0; i <= k; i++) {
    a.push_back(0);
  }
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    a[tmp]++;
  }
  int so, slo, se;
  se = slo = so = 0;
  for (int i = 1; i <= k; i++) {
    if (a[i] % 2 == 0) {
      se += a[i];
    } else {
      so += a[i];
      slo++;
    }
  }
  int n2 = n / 2 + n % 2;
  n2 = n2 - se / 2;
  n2 = n2 - (so + slo) / 2;
  cout << n + n2;
}
