#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 100;
int a[maxn], b[maxn];
int cnt[maxn];
int main() {
  int n, I;
  ios::sync_with_stdio(false);
  cin >> n >> I;
  I *= 8;
  I /= n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) b[i] = a[i];
  sort(b, b + n);
  int d = unique(b, b + n) - b;
  for (int i = 0; i < n; ++i) a[i] = lower_bound(b, b + d, a[i]) - b + 1;
  for (int i = 0; i < n; ++i) cnt[a[i]]++;
  for (int i = 1; i <= d; ++i) cnt[i] += cnt[i - 1];
  if (I >= 30)
    I = d;
  else
    I = (1 << I);
  I = min(I, d);
  int ans = 0;
  for (int i = 1; i <= d; ++i) {
    if (i - I >= 0) ans = max(ans, cnt[i] - cnt[i - I]);
  }
  cout << n - ans << endl;
  return 0;
}
