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