#include <bits/stdc++.h>
int n, k;
int times[2005];
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    times[a]++;
  }
  int left = n / 2 + n % 2;
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    int take = std::min(left, times[i] / 2);
    left -= take;
    ans += take * 2;
  }
  ans += left;
  ans = std::min(n, ans);
  printf("%d\n", ans);
  return 0;
}
