#include <bits/stdc++.h>
using namespace std;
int n, k;
priority_queue<int> pq;
int bf() {
  int res = 0;
  for (int i = 0; i < (n + 1) / 2; i++) {
    int x = pq.top() - 2;
    pq.pop();
    cerr << x << '\n';
    pq.push(x);
  }
  for (int i = 0; i < (int)pq.size(); i++) {
    if (pq.top() < 1) return res;
    res += pq.top();
    pq.pop();
  }
  return res;
}
int main() {
  cin >> n >> k;
  vector<int> a(k + 1);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
    ;
  }
  for (int i = 1; i <= k; i++) {
    pq.push(a[i]);
  }
  int res = bf();
  cout << n - res << '\n';
  return 0;
}
