#include <bits/stdc++.h>
using namespace std;
long long int M = 100000000000000;
long long int M1 = 1000000007;
int main() {
  long long int n, k, x1, x2, x3, x, i, ans = 0;
  cin >> n >> k;
  x3 = ceil(n / 2.0);
  vector<int> cnt(k + 1, 0);
  for (i = 0; i < n; i++) {
    cin >> x;
    cnt[x]++;
  }
  x1 = 0;
  for (i = 1; i <= k; i++) {
    x1 += cnt[i] / 2;
  }
  ans += x3 - x1;
  ans += x1 * 2;
  cout << ans << endl;
}
