#include <bits/stdc++.h>
using namespace std;
int s[1010];
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    s[a]++;
  }
  int res = 0;
  int t;
  if (n % 2)
    t = n / 2 + 1;
  else
    t = n / 2;
  for (int i = 1; i <= k; i++) {
    if (s[i] % 2 == 0 && s[i] != 0) {
      res = res + s[i];
      t = t - s[i] / 2;
      s[i] = 0;
    } else if (s[i] % 2 == 1 && s[i] > 1) {
      res = res + s[i] - 1;
      t = t - s[i] / 2;
      s[i] = 1;
    }
  }
  printf("%d\n", res + t);
}
