#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(k + 1);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  int result = 0;
  int times = 0;
  for (int i = 1; i <= k; i++) {
    if (a[i] > 1) {
      int x = a[i] / 2;
      a[i] -= x * 2;
      result += x * 2;
      times += x;
    }
  }
  while (true) {
    for (int i = 1; i <= k; i++) {
      if (times == (n + 1) / 2) {
        cout << result;
        return 0;
      }
      if (a[i] == 1) {
        a[i] -= 1;
        result += 1;
        times += 1;
      }
    }
  }
}
