#include <bits/stdc++.h>
using namespace std;
long long n, k, x, ta, a[1010], i, has;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  x = n / 2 + n % 2;
  for (i = 1; i <= n; i++) {
    cin >> ta;
    a[ta]++;
  }
  for (i = 1; i <= k; i++) {
    long long tem = a[i] / 2;
    x -= tem;
    has += tem * 2;
    a[i] %= 2;
  }
  for (i = 1; i <= k; i++) {
    if (x > 0 && (a[i] > 0)) {
      x--;
      a[i]--;
      has++;
    }
  }
  cout << has << "\n";
}
