#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
double eps = 1e-12;
long long hcf(long long p, long long q) {
  if (p > q) return hcf(q, p);
  if (!p) return q;
  return hcf(q % p, p);
}
long long lcm(long long p, long long q) { return p * q / hcf(p, q); }
long long power(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n) {
    if (n % 2) ans *= a;
    a *= a;
    n /= 2;
    a %= mod;
    ans %= mod;
  }
  return ans;
}
long long fac(long long k, long long mod) {
  long long ans = 1;
  for (long long i = 1; i < k + 1; i++) {
    ans *= i;
    ans %= mod;
  }
  return ans;
}
void solve() {
  long long n, I;
  cin >> n >> I;
  map<long long, long long> b;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    b[x]++;
  }
  vector<pair<long long, long long> > a;
  for (auto i : b) a.push_back(i);
  long long k = I * 8 / n;
  if (k > 30) k = 30;
  k = pow(2, k);
  n = ((long long)(a).size());
  vector<long long> pre(n), suf(n);
  for (long long i = 0; i < n; i++) {
    if (i == 0)
      pre[i] = a[i].second;
    else
      pre[i] = pre[i - 1] + a[i].second;
  }
  for (long long i = n - 1; i >= 0; i--) {
    if (i == n - 1)
      suf[i] = a[i].second;
    else
      suf[i] = suf[i + 1] + a[i].second;
  }
  long long ans = LONG_LONG_MAX;
  for (long long i = 0; i < n; i++) {
    long long v = 0;
    if (i != 0) v += pre[i - 1];
    long long j = i + k;
    if (j < n) v += suf[j];
    ans = min(ans, v);
  }
  cout << ans << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
