#include <bits/stdc++.h>
using namespace std;
int a, b, c, l, r, x[2000000], y, z, man, mix, d[2000000], ans, ans1;
vector<long long> v1, v;
int main() {
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    cin >> d[i];
    x[d[i]]++;
  }
  ans1 = (a + 1) / 2;
  for (int i = 1; i <= b; i++) {
    if (x[i] % 2 == 0) {
      ans += x[i];
      ans1 -= x[i] / 2;
    }
  }
  for (int i = 1; i <= b; i++) {
    if (x[i] % 2 == 1) {
      ans1 -= x[i] / 2;
      ans += x[i] - 1;
    }
  }
  cout << ans + ans1;
}
