#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  int k = 0;
  cin >> n >> k;
  int a[n + 1];
  int b[k + 1];
  int sum = 0;
  int odd = 0;
  int dont = 0;
  for (int j = 1; j <= k; j++) {
    b[j] = 0;
  }
  for (int i = 1; i <= n; i++) {
    a[i] = 0;
    cin >> a[i];
    for (int j = 1; j <= k; j++) {
      if (a[i] == j) {
        b[j]++;
      }
    }
  }
  for (int j = 1; j <= k; j++) {
    if (b[j] % 2 == 0) {
      sum += (b[j] / 2);
    } else {
      sum += ((b[j] - 1) / 2);
      odd++;
    }
  }
  if (n % 2 == 0) {
    dont = odd - ((n / 2) - sum);
  } else {
    dont = odd - (((n + 1) / 2) - sum);
  }
  cout << n - dont << endl;
  return 0;
}
