#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 1024;
int a[N];
int n;
void f() {
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a[x]++;
  }
  int res = 0;
  int sets = n / 2;
  if (n % 2 == 1) sets += 1;
  int odd = 0, even = 0;
  for (int i = 1; i <= k; ++i) {
    if (a[i] % 2 == 0) {
      even += a[i];
    } else {
      even += (a[i] - 1);
      odd += 1;
    }
  }
  int v = min(sets, even / 2);
  res += v * 2;
  sets -= v;
  v = min(odd, max(sets, 0));
  res += v;
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  int k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    a[x]++;
  }
  int res = 0;
  int sets = (int)ceil(n * 1.0 / 2);
  int even = 0, odd = 0;
  for (int i = 1; i <= k; ++i) {
    even += a[i] / 2;
    odd += a[i] % 2;
  }
  res += even * 2 + min(odd, sets - even);
  cout << res;
  return 0;
}
