#include <bits/stdc++.h>
using namespace std;
long long a[100002];
long long mp[100002];
int main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  long long cnt = 0;
  long long ans = 0;
  for (long long i = 1; i <= k; i++) {
    if (mp[i]) {
      ans += mp[i];
      if (mp[i] % 2) {
        ans--;
        cnt++;
      }
    }
  }
  ans = ans + (cnt / 2) + (cnt % 2 != 0);
  cout << ans << endl;
  return 0;
}
