#include <bits/stdc++.h>
using namespace std;
long long arr[1000005];
long long pref[1000005], suff[1000005];
void solve() {
  long long n, I, i, x, l, r, ans;
  cin >> n >> I;
  map<long long, long long> m;
  set<long long> s;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    m[arr[i]]++;
    s.insert(arr[i]);
  }
  vector<long long> v;
  for (auto j : s) v.push_back(j);
  for (i = 0; i < v.size(); i++) {
    if (i)
      pref[i] = pref[i - 1] + m[v[i]];
    else
      pref[i] = m[v[i]];
  }
  for (i = v.size() - 1; i >= 0; i--) {
    suff[i] = suff[i + 1] + m[v[i]];
  }
  I = 8 * I;
  I /= n;
  if (I >= n) {
    cout << 0 << '\n';
    return;
  }
  x = pow(2, I);
  l = 0;
  r = x - 1;
  ans = LLONG_MAX;
  if (x >= v.size()) {
    cout << 0 << '\n';
    return;
  } else {
    while (l + x < v.size()) {
      if (l + x >= v.size()) {
        ans = min(ans, suff[v.size() - 1] + (l > 0 ? pref[l - 1] : 0));
      } else
        ans = min(ans, suff[l + x] + (l > 0 ? pref[l - 1] : 0));
      l++;
    }
  }
  cout << ans << '\n';
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  { solve(); }
  cerr << " Execution : " << (1.0 * clock()) / CLOCKS_PER_SEC << "s \n";
  return 0;
}
