#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> kek(n + 1, 0);
  vector<long long> tmp(k + 1, 0);
  for (long long i = 0; i < n; i++) {
    cin >> kek[i];
    tmp[kek[i]]++;
  }
  long long cnt = 0;
  for (long long i = 1; i <= (n + 1) / 2; i++) {
    sort(tmp.begin(), tmp.end());
    if (tmp[tmp.size() - 1] >= 2) {
      tmp[tmp.size() - 1] -= 2;
      cnt += 2;
    } else {
      cnt += tmp[tmp.size() - 1];
      tmp[tmp.size() - 1] = 0;
    }
  }
  cout << cnt;
  return 0;
}
