#include <bits/stdc++.h>
using namespace std;
struct Dbg {
  template <typename T>
  Dbg& operator,(const T& v) {
    cerr << v << ", ";
    return *this;
  }
} Dbg;
template <typename T>
ostream& operator<<(ostream& _o_, const vector<T>& _v_) {
  if (!_v_.empty()) {
    _o_ << '[';
    copy(_v_.begin(), _v_.end(), ostream_iterator<T>(_o_, ", "));
    _o_ << "\b\b]";
  }
  return _o_;
}
template <class C>
void mini(C& _a, C _b) {
  _a = min(_a, _b);
}
template <class C>
void maxi(C& _a, C _b) {
  _a = max(_a, _b);
}
map<int, int> cnt;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, I;
  cin >> n >> I;
  I *= 8;
  vector<int> a(n);
  int K = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<int> ind;
  for (int i = 0; i < n; i++) {
    if (!i)
      ind.push_back(i);
    else if (a[i] != a[i - 1])
      ind.push_back(i);
  }
  int needed = I / n;
  if (needed < 30)
    needed = 1 << needed;
  else
    needed = 1 << 30;
  int diff = ind.size();
  if (needed >= diff) {
    cout << 0;
    return 0;
  }
  int ans = 1e9;
  for (int i = 0; i < diff - needed; i++) {
    mini(ans, (n - (ind[i + needed] - ind[i])));
  }
  cout << ans;
  return 0;
}
