#include <bits/stdc++.h>
using namespace std;
long long log_2(long long x) {
  long long res = 0;
  long long now = 1;
  while (x > now) {
    now *= 2;
    ++res;
  }
  return res;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, I;
  cin >> n >> I;
  vector<long long> a(n);
  set<long long> st;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    st.insert(a[i]);
  }
  if (n * log_2(st.size()) <= 8 * I) {
    cout << 0 << '\n';
    return 0;
  }
  sort(a.begin(), a.end());
  long long cnt = 1;
  vector<long long> v;
  for (long long i = 0; i < n; ++i) {
    if (i == n - 1)
      v.push_back(cnt);
    else if (a[i] == a[i + 1])
      ++cnt;
    else {
      v.push_back(cnt);
      cnt = 1;
    }
  }
  long long m = v.size();
  vector<long long> sum(m);
  for (long long i = 0; i < m; ++i) {
    if (i) {
      sum[i] = sum[i - 1] + v[i];
    } else {
      sum[i] = v[i];
    }
  }
  long long num = I * 8;
  long long maximum = 0;
  while (n * (log_2(maximum)) <= 8 * I) {
    ++maximum;
  }
  long long ans = 1e18;
  for (long long i = 0; i + maximum - 2 < m; ++i) {
    if (i + maximum - 2 < 0) {
      continue;
    } else if (i) {
      ans = min(ans, sum[m - 1] - sum[i + maximum - 2] + sum[i - 1]);
    } else {
      ans = min(ans, sum[m - 1] - sum[i + maximum - 2]);
    }
  }
  cout << ans << '\n';
  return 0;
}
