#include <bits/stdc++.h>
using namespace std;
int a[10000], cnt;
int main() {
  int n, k, x;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a[x]++;
  }
  vector<int> b;
  for (int i = 1; i <= k; i++) b.push_back(a[i]);
  int o = 0;
  for (int i = 0; i < b.size(); i++) {
    cnt += (b[i] - b[i] % 2);
    o += b[i] % 2;
  }
  cout << cnt + o / 2 + o % 2 << endl;
}
