#include <bits/stdc++.h>
using namespace std;
int n, k, cnt[1005];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  int m = ceil(n / 2.0), ans = 0;
  for (int i = 1; i <= k; i++) {
    if (cnt[i] > 1) {
      ans += cnt[i] / 2 * 2;
      m -= cnt[i] / 2;
    }
    if (m <= 0) break;
  }
  printf("%d", ans + m);
  return 0;
}
