#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n), f(k + 1, 0);
  for (long long i = 0; i < n; i++) cin >> a[i], f[a[i]]++;
  long long c = 0;
  for (long long i = 1; i < k + 1; i++) c += f[i] % 2;
  cout << n - (c / 2);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TESTS = 1;
  while (TESTS--) {
    solve();
  }
  return 0;
}
