#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int data[n];
  for (int i = 0; i < n; i++) {
    cin >> data[i];
  }
  int counts[k];
  for (int i = 0; i < k; i++) {
    counts[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    counts[data[i] - 1]++;
  }
  int ans = 0;
  int countOdd = 0;
  for (int i = 0; i < k; i++) {
    int odd = counts[i] % 2;
    ans += counts[i] - odd;
    countOdd += odd;
  }
  if (countOdd % 2 == 1) countOdd++;
  ans += countOdd / 2;
  cout << ans << endl;
  return 0;
}
