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