#include <bits/stdc++.h>
using namespace std;
template <class T>
bool rmn(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool rmx(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
const long long INFLL = 0x7f7f7f7f7f7f7f7f, MOD = 1e9 + 7;
const long long INF = 0x7f7f7f7f;
vector<vector<pair<long long, long long>>> adj;
vector<long long> vis, color;
long long dx8[] = {0, 1, 1, 1, 0, -1, -1, -1},
          dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx4[] = {0, 1, 0, -1},
          dy4[] = {1, 0, -1, 0};
inline long long mexp(long long x, long long n, long long m = MOD) {
  long long res = 1;
  x %= m;
  while (n) {
    if (n & 1) res = (res * x) % m;
    n >>= 1;
    x = (x * x) % m;
  }
  return res;
}
inline long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  while (a > 0 && b > 0) {
    if (a > b)
      a %= b;
    else
      b %= a;
  }
  return a + b;
}
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed;
  cerr << fixed;
  cout << setprecision(10);
  cerr << setprecision(3);
  mt19937 genr(chrono::high_resolution_clock::now().time_since_epoch().count());
  long long n, k;
  cin >> n >> k;
  k = (8 * k) / n;
  map<long long, long long> m;
  for (long long i = 0; i < n; ++i) {
    long long t;
    cin >> t;
    m[t]++;
  }
  long long ans = 0;
  if (k >= 19 || (1 << k) >= ((long long)(m).size())) {
    ans = n;
  } else if (k == 0) {
    for (auto &[e, f] : m) ans = max(ans, f);
  } else {
    long long w = 1 << k, cur = 0;
    auto p = m.begin(), q = p;
    for (long long i = 0; i < w && p != m.end(); ++i, ++p) cur += (*p).second;
    ans = max(ans, cur);
    while (p != m.end()) {
      cur += (*p).second - (*q).second;
      ans = max(ans, cur);
      ++p, ++q;
    }
  }
  cout << n - ans << '\n';
  return 0;
}
