#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18;
const long long int mod = 1e9 + 7;
inline long long int add(long long int x, long long int y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline long long int sub(long long int x, long long int y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
inline long long int mul(long long int x, long long int y) {
  return ((x % mod) * (y % mod)) % mod;
}
inline long long int power(long long int a, long long int b) {
  long long int x = 1;
  while (b) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline long long int inv(long long int a) { return power(a, mod - 2); }
const int N = 1e6 + 6;
int logs[N], cnt[N];
void computeLogs() {
  for (int i = 2; i < N; i++) {
    int p = i / 2;
    if (i & 1) ++p;
    logs[i] = logs[p] + 1;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  computeLogs();
  int n, I;
  cin >> n >> I;
  I *= 8;
  vector<int> a(n), b(n);
  map<int, int> mp;
  int k = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b.begin(), b.end());
  for (int i = 0; i < n; i++) {
    if (mp.find(b[i]) == mp.end()) {
      mp[b[i]] = k++;
    }
  }
  for (int i = 0; i < n; i++) {
    a[i] = mp[a[i]];
    cnt[a[i]]++;
  }
  int l = 1, r = 1, change = n - cnt[1], ans = n, cost = 0;
  while (1) {
    if (l > r || r >= k) break;
    int bitsNeeded = logs[r - l + 1];
    cost = bitsNeeded * n;
    if (cost <= I) {
      ans = min(ans, change);
      r += 1;
      change -= cnt[r];
    } else {
      change += cnt[l];
      l += 1;
    }
  }
  cout << ans << endl;
  return 0;
}
