#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 9;
vector<long long> v;
map<long long, long long> cnt;
long long a[N], b[N];
int main() {
  long long n, x, d, ans = 0;
  scanf("%lld %lld", &n, &d);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &x);
    if (!cnt[x]) v.push_back(x);
    cnt[x]++;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); ++i) {
    a[i] = cnt[v[i]];
    b[i] = cnt[v[i]];
  }
  for (int i = 1; i < v.size(); ++i) a[i] += a[i - 1];
  for (int i = v.size() - 2; i >= 0; --i) b[i] += b[i + 1];
  long long sz = v.size();
  long long bits = ceil(log2(sz));
  if (bits * n <= 1ll * 8 * d) {
    puts("0");
    return 0;
  }
  long long c = 0;
  int tsz = sz;
  while (1) {
    sz--;
    c++;
    bits = ceil(log2(sz));
    if (bits * n <= 1ll * 8 * d) break;
  }
  ans = LONG_MAX;
  for (long long i = tsz - 1;; i--) {
    long long j = c - (tsz - 1 - i);
    j--;
    if (i < 0 || j < 0) break;
    long long calc = 0;
    if (i + 1 <= tsz - 1) calc += b[i + 1];
    if (j >= 0) calc += a[j];
    ans = min(ans, calc);
  }
  printf("%lld\n", ans);
  return 0;
}
