#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
using pii = std::pair<long long, long long>;
using namespace std;
long long n, k, a, cnt[1005] = {0};
class ADrinksChoosing {
 public:
  void solve(std::istream& in, std::ostream& out) {
    in >> n >> k;
    for (long long i = (0); i < (n); i++) {
      in >> a;
      a--;
      cnt[a]++;
    }
    long long diff = 0;
    for (long long i = (0); i < (k); i++)
      if (cnt[i] & 1) diff++;
    out << n - (diff / 2) << "\n";
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ADrinksChoosing solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
