#include <bits/stdc++.h>
using namespace std;
int arr[1001];
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  std::cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int s;
    std::cin >> s;
    arr[s - 1]++;
  }
  int pairs = 0;
  for (auto t : arr) pairs += t / 2;
  auto leftover = n - 2 * pairs;
  auto have = (n + 1) / 2;
  int caf = std::min(have, pairs);
  have -= caf;
  pairs -= caf;
  int res = 2 * caf;
  if (have > 0) {
    caf = std::min(have, leftover);
    res += caf;
  }
  std::cout << res << std::endl;
  return 0;
}
