#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, I;
  cin >> n >> I;
  I *= 8LL;
  map<long long, long long> mp;
  for (int i = 0, x; i < n; ++i) {
    cin >> x;
    mp[x]++;
  }
  vector<pair<int, int>> v;
  for (auto i : mp) {
    v.push_back(make_pair(i.first, i.second));
  }
  sort(v.begin(), v.end());
  long long k = min((I / n), 25LL);
  long long K = (1LL << k);
  if (K >= (int)v.size())
    cout << 0 << '\n';
  else {
    vector<long long> s(v.size(), 0);
    for (int i = 0; i < (int)v.size(); ++i) {
      s[i] = (!i ? 0 : s[i - 1]) + v[i].second;
    }
    long long ans = 1LL << 20;
    for (int i = K - 1, j = 0; i < (int)v.size(); ++i, ++j) {
      ans = min(ans, n - (s[i] - (!j ? 0 : s[j - 1])));
    }
    cout << ans << '\n';
  }
  return 0;
}
