#include <bits/stdc++.h>
using namespace std;
int n, k, c[1001], i, x, a, b;
int main() {
  cin >> n >> k;
  for (int x, i = 1; i <= n; ++i) {
    cin >> x;
    c[x]++;
  }
  for (i = 1; i <= k; ++i) {
    a = a + c[i] / 2 * 2;
    b = b + c[i] % 2;
  }
  cout << a + (b + 1) / 2;
}
