#include <bits/stdc++.h>
using namespace std;
int a[1001], ck[1001];
int n, k;
int sets, used, odd;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ck[a[i]]++;
  }
  sets = (n + 1) / 2;
  for (int i = 1; i <= k; i++) {
    used += ck[i] / 2;
    if (ck[i] % 2 == 1) odd++;
  }
  cout << n - (odd - (sets - used));
}
