#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int k, tong[maxn], n, tp;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tp);
    tong[tp]++;
  }
  int maxx;
  if (n % 2 == 0)
    maxx = n / 2;
  else
    maxx = n / 2 + 1;
  int ans = 0, dou = 0;
  for (int i = 1; i <= k; i++) {
    while (tong[i] >= 2) {
      ans += 2;
      tong[i] -= 2;
    }
  }
  if (ans >= maxx * 2) {
    cout << maxx * 2;
    return 0;
  } else {
    maxx -= (ans) / 2;
    cout << maxx + ans << endl;
    return 0;
  }
}
