#include <bits/stdc++.h>
using namespace std;
const long long MODPRIME = 1e9 + 7;
const double EPS = 1e-12;
const long long MAXL = 4e18;
const long long MINL = -4e18;
const int MAXI = 2e9;
const int MINI = -2e9;
int n, k;
int arr[1005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    arr[x]++;
  }
  int tot = 0;
  int sisa = 0;
  for (int i = 1; i <= k; i++) {
    if (arr[i] % 2 == 0) {
      tot += arr[i];
    } else {
      tot += arr[i] - 1;
      sisa++;
    }
  }
  cout << tot + (sisa % 2 == 0 ? sisa / 2 : sisa / 2 + 1) << '\n';
  return 0;
}
