#include <bits/stdc++.h>
using namespace std;
int n, a, k, cnt[1001], ans;
int main() {
  scanf("%d%d", &n, &k);
  int nn = n;
  while (nn--) scanf("%d", &a), cnt[a]++;
  if (n % 2 == 0)
    n /= 2;
  else
    n = n / 2 + 1;
  for (int i = 1; i <= k; i++) {
    if (cnt[i] % 2 == 0 && n >= cnt[i] / 2)
      n = n - cnt[i] / 2, ans = ans + cnt[i], cnt[i] = 0;
    else if (cnt[i] % 2 == 1 && n >= cnt[i] / 2)
      n = n - cnt[i] / 2, ans = ans + cnt[i] - 1, cnt[i] = 1;
    else if (n <= 0)
      break;
  }
  if (n <= 0)
    printf("%d", ans);
  else {
    int cntt = 0;
    for (int i = 1; i <= k; ++i)
      if (cnt[i] != 0) {
        if (n <= 0) break;
        if (cnt[i] / 2 > n) {
          ans = ans + n * 2;
          break;
        } else {
          if (cnt[i] % 2 == 0)
            ans = ans + cnt[i], n = n - cnt[i] / 2, cnt[i] = 0;
          else
            ans = ans + cnt[i] - 1, n = n - cnt[i] / 2, cnt[i] = 1, ++cntt;
        }
      }
    if (n <= 0)
      printf("%d", ans);
    else {
      ans += min(cntt, n);
      printf("%d", ans);
    }
  }
  return 0;
}
