#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 7;
long long a[maxn];
long long quick(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) {
      ans *= x;
    }
    x *= x;
    y >>= 1;
  }
  return ans;
}
map<long long, int> mp;
map<int, long long> mm;
set<long long> se;
vector<long long> vec;
int main() {
  int n;
  long long I;
  scanf("%d%lld", &n, &I);
  long long k = 8 * I / n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    mp[a[i]]++;
    se.insert(a[i]);
  }
  if (k >= 19) {
    cout << 0 << endl;
    return 0;
  }
  long long K = quick(2ll, k);
  for (auto u : se) vec.push_back(u);
  sort(vec.begin(), vec.end());
  for (int i = 0; i < vec.size(); i++) mm[vec[i]] = i;
  int l1 = 0, l2 = 0, r = 0, ans = 0;
  int tmp = 0;
  for (int i = 0; i < vec.size(); i++) {
    tmp += mp[vec[i]];
    if (i - l1 + 1 == K) {
      ans = max(ans, tmp);
      tmp -= mp[vec[l1]];
      l1++;
    }
  }
  ans = max(ans, tmp);
  cout << max(n - ans, 0) << endl;
}
