#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int a[1010];
int main() {
  int n, k, x, d;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a[x]++;
  }
  if (n % 2 == 0)
    d = n / 2;
  else
    d = (n + 1) / 2;
  int sum = 0;
  for (int i = 1; i <= k; i++) {
    if (a[i] % 2 == 0) {
      a[i] == 0;
      sum += a[i];
    } else {
      sum += (a[i] - 1);
      a[i] = 1;
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] == 1) cnt++;
  if (d - (sum / 2) > 0) sum += (d - sum / 2);
  cout << sum << endl;
  return 0;
}
