#include <bits/stdc++.h>
using namespace std;
int a[400010];
int main() {
  int i, j;
  int n, t;
  int I;
  double h, l;
  cin >> n >> I;
  map<int, int> mp;
  for (i = 0; i < n; i++) {
    scanf("%d", &t);
    mp[t]++;
  }
  I *= 8;
  int mil = I / n;
  int d;
  if (mil > 29)
    d = 9999999;
  else
    d = pow(2, mil);
  map<int, int>::iterator it, jt;
  it = mp.begin();
  jt = mp.end();
  i = 0;
  for (; it != jt; it++) {
    a[i++] = it->second;
  }
  int cc = i;
  int sum = 0;
  for (i = 0; i < d && i < cc; i++) sum += a[i];
  int ans = 0;
  ans = max(ans, sum);
  for (i = 1; i + d - 1 < cc; i++) {
    sum -= a[i - 1];
    sum += a[i + d - 1];
    ans = max(ans, sum);
  }
  if (ans > n) ans = n;
  cout << n - ans << endl;
  return 0;
}
