#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k;
  cin >> n >> k;
  map<int, int> mp;
  vector<int> odd;
  vector<int> even;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    if (mp[num] == 0) v.push_back(num);
    mp[num]++;
  }
  for (int i = 0; i < v.size(); i++) {
    if (mp[v[i]] % 2 == 0)
      even.push_back(mp[v[i]]);
    else
      odd.push_back(mp[v[i]]);
  }
  int m = n / 2 + n % 2;
  int ans = 0;
  for (int i = 0; i < even.size(); i++) {
    if (even[i] / 2 <= m) {
      m -= even[i] / 2;
      ans += even[i];
    } else {
      ans += m * 2;
      m = 0;
      break;
    }
  }
  if (m > 0) {
    int rest = 0;
    for (int i = 0; i < odd.size(); i++) {
      if (odd[i] / 2 <= m) {
        m -= odd[i] / 2;
        ans += odd[i] - 1;
        rest++;
      } else {
        ans += m * 2;
        m = 0;
        break;
      }
    }
    if (m > 0) ans += min(m, k);
  }
  cout << ans << endl;
  return 0;
}
