#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, b;
  cin >> n >> b;
  int max_dist = 1 << (min(30, (b * 8) / n));
  map<int, int> mp;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    mp[x] += 1;
  }
  cerr << ("max_dist") << ": " << (max_dist) << ' ' << endl;
  int ans = 0, res = 0;
  auto it = mp.begin();
  int curr_dist = 0;
  for (auto &p : mp) {
    curr_dist += 1;
    ans += p.second;
    if (curr_dist > max_dist) {
      ans -= it->second;
      ++it;
    }
    res = max(res, ans);
  }
  cout << n - res << endl;
}
