#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int count[k + 1];
  memset(count, 0, sizeof(count));
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    count[tmp]++;
  }
  int pos = ceil(n / 2.0), sat = 0;
  for (int i = 1; i <= k; i++) {
    pos -= (count[i] / 2);
    sat += 2 * (count[i] / 2);
  }
  sat += pos;
  cout << sat << endl;
}
