#include <bits/stdc++.h>
using namespace std;
int n, m, k, t;
int a[100005];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> k;
    a[k]++;
  }
  for (int i = 1; i <= m; i++)
    if (a[i] & 1) t++;
  cout << n - t / 2 << endl;
}
