#include <bits/stdc++.h>
int n, k, arr[1005], aux, p, c = 0, d;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &aux);
    arr[aux]++;
  }
  p = (n + 1) / 2;
  for (int i = 1; i <= k; i++) {
    d = arr[i] / 2;
    if (p >= d) {
      p -= d;
      c += (d * 2);
    }
  }
  c += p;
  printf("%d", c);
}
