#include <bits/stdc++.h>
using namespace std;
int is[10005];
int n, k, t;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    is[t]++;
  }
  int a, b, c;
  a = b = c = 0;
  for (int i = 1; i <= k; ++i) {
    b += is[i] % 2;
    a += is[i] / 2 * 2;
  }
  c = a + (b + 1) / 2;
  printf("%d\n", c);
  return 0;
}
