#include <bits/stdc++.h>
const int oo = 2139063143;
const int N = 1010000;
const int P = 1000000007;
using namespace std;
inline void sc(int &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
inline void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
inline void pr(int x) { print(x), putchar('\n'); }
int a[N];
int main() {
  int n, k;
  sc(n), sc(k);
  int m = n / 2 + (n & 1);
  int sb;
  for (int i = 1; i <= n; i++) sc(sb), ++a[sb];
  int ans = 0;
  for (int i = 1; i <= k; i++) ans += a[i] / 2 * 2, m -= a[i] / 2, a[i] &= 1;
  pr(ans + m);
  return 0;
}
