#include <bits/stdc++.h>
using namespace std;
int n, lim;
int a[400007];
vector<int> srt;
int MAXVAL;
int cnt[400007];
int pref[400007];
void input() {
  scanf("%d%d", &n, &lim);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    srt.push_back(a[i]);
  }
  sort(srt.begin(), srt.end());
  map<int, int> ZX;
  MAXVAL = 1;
  ZX[srt[0]] = MAXVAL;
  for (int i = 1; i <= n; ++i) {
    if (srt[i] == srt[i - 1]) {
      continue;
    }
    ZX[srt[i]] = ++MAXVAL;
  }
  for (int i = 1; i <= n; ++i) {
    a[i] = ZX[a[i]];
    ++cnt[a[i]];
  }
  for (int i = 1; i <= MAXVAL; ++i) {
    pref[i] = (pref[i - 1] + cnt[i]);
  }
}
void solve() {
  lim *= 8;
  long long aux = 1;
  long long h = 0;
  while ((h + 1) * n <= lim) {
    ++h;
    aux *= 2;
    if (aux > MAXVAL) {
      break;
    }
  }
  if (aux > MAXVAL) {
    aux = MAXVAL;
  }
  int mn = -1;
  for (int i = 1; i + aux - 1 <= MAXVAL; ++i) {
    int curr = pref[i - 1] + (pref[MAXVAL] - pref[i + aux - 1]);
    if (mn < 0) {
      mn = curr;
    }
    if (mn > curr) {
      mn = curr;
    }
  }
  printf("%d\n", mn);
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  input();
  solve();
  return 0;
}
