#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
const long long INF = 1000000002;
map<int, int> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k, ans = 0, x;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    mp[x]++;
  }
  n = (n + 1) / 2;
  for (int i = 1; i <= k; i++) {
    if (n - mp[i] / 2 >= 0) {
      ans += (mp[i] / 2) * 2;
      n -= mp[i] / 2;
    } else {
      ans += n * 2;
      cout << ans;
      return 0;
    }
  }
  for (int i = 1; i <= k; i++) {
    if (mp[i] % 2 == 1) {
      if (n) {
        ans++;
        n--;
      } else {
        cout << ans;
        return 0;
      }
    }
  }
  cout << ans;
}
