#include <bits/stdc++.h>
using namespace std;
int n, k, cnt[1010], ans;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    cnt[x]++;
  }
  for (int i = 1; i <= (n + 1) / 2; i++) {
    int idx = -1, mx = -1;
    for (int j = 1; j <= k; j++) {
      if (cnt[j] > mx) {
        mx = cnt[j];
        idx = j;
      }
    }
    if (cnt[idx] >= 2) {
      ans += 2;
      cnt[idx] -= 2;
    } else {
      ans += cnt[idx];
      cnt[idx] = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
