#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
vector<long long int> sum;
long long int bin_exp(long long int a, long long int b) {
  a = a % mod;
  long long int ans = 1;
  while (b > 0) {
    if (b & 1 == 1) ans = (a * ans) % mod;
    a = (a * a) % mod;
    b = b >> 1;
  }
  return ans;
}
void solve() {
  long long int n, t;
  cin >> n >> t;
  t *= 8;
  t /= n;
  set<long long int> s;
  vector<long long int> v(n);
  map<long long int, long long int> m;
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
    s.insert(v[i]);
    m[v[i]] = 1;
  }
  long long int temp = s.size();
  long long int p = 0;
  while ((1LL << p) < temp) p++;
  if (p <= t) {
    cout << 0 << "\n";
    return;
  }
  t = bin_exp(2, t);
  sum.resize(400002);
  long long int ind = 1;
  for (auto x : m) {
    m[x.first] = ind;
    ind++;
  }
  for (auto x : v) {
    sum[m[x]]++;
  }
  long long int ans = 0;
  for (long long int i = 1; i < 400002; i++) {
    sum[i] += sum[i - 1];
    if (i - t >= 0) {
      ans = max(ans, sum[i] - sum[i - t]);
    }
  }
  cout << n - ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  for (long long int i = 0; i < t; i++) {
    solve();
  }
}
