#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int n;
map<int, int> cnt;
long long I;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> I;
  int mx = 1 << min(25, (int)(I * 8 / n));
  for (int i = 0; i < (n); i++) {
    long long a;
    cin >> a;
    cnt[a]++;
  }
  vector<pair<int, int> > v;
  for (const pair<int, int> p : cnt) v.push_back(p);
  int curr = 0;
  for (int i = (mx); i < (((int)(v).size())); i++) curr += v[i].second;
  int res = curr;
  for (int i = (mx); i < (((int)(v).size())); i++) {
    curr -= v[i].second;
    curr += v[i - mx].second;
    res = min(res, curr);
  }
  cout << res << endl;
}
