#include <bits/stdc++.h>
using namespace std;
int s[1005], n, k, i, x, m, ans;
int main() {
  cin >> n >> k;
  m = (n + 1) / 2;
  for (i = 0; i < n; i++) {
    cin >> x;
    s[x]++;
  }
  for (i = 0; i <= k; i++) {
    ans += s[i] / 2 * 2;
    m -= s[i] / 2;
  }
  cout << ans + m << endl;
  return 0;
}
