#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
int cnt[20000];
int main() {
  int n, k;
  while (cin >> n >> k) {
    int ans = 0;
    memset(cnt, (0), sizeof(cnt));
    int m = (n + 1) / 2;
    int x;
    for (register int i = (1); i <= (n); ++i) {
      cin >> x;
      cnt[x]++;
    }
    int can = 0;
    for (register int i = (1); i <= (k); ++i) {
      can += cnt[i] / 2;
      cnt[i] %= 2;
    }
    if (can >= m) {
      ans = min(n, m * 2);
      cout << ans << endl;
      continue;
    }
    m -= can;
    ans = can * 2;
    for (register int i = (1); i <= (k); ++i) {
      if (m <= 0) break;
      if (cnt[i]) ans += cnt[i], m--;
    }
    ans = min(ans, n);
    cout << ans << endl;
  }
  return 0;
}
