#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 100005;
int in[N];
int main() {
  int n, I;
  scanf("%d %d", &n, &I);
  int k = (I * 8) / n;
  int K = (1LL << k);
  if (k > 30 or K > n) return !printf("0\n");
  vector<int> in(n), dat(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &in[i]);
    dat[i] = in[i];
  }
  sort(begin(dat), end(dat));
  dat.erase(unique(begin(dat), end(dat)), end(dat));
  int m = dat.size();
  for (int i = 0; i < n; i++) {
    int x = lower_bound(begin(dat), end(dat), in[i]) - begin(dat) + 1;
    in[i] = x;
  }
  vector<int> pref(m + 2, 0), suff(m + 2, 0);
  for (int i = 0; i < n; i++) {
    pref[in[i]]++;
    suff[in[i]]++;
  }
  for (int i = 1; i <= m; i++) pref[i] += pref[i - 1];
  for (int i = m; i >= 1; i--) suff[i] += suff[i + 1];
  int best = n;
  if (K > m) return !printf("0\n");
  for (int i = 1; i + K - 1 <= m; i++) {
    best = min(best, pref[i - 1] + suff[i + K]);
  }
  printf("%d\n", best);
}
