#include <bits/stdc++.h>
using namespace std;
const int INT_INF = 1e9;
const long long LL_INF = 1e18;
const int MAXN = 500003;
typedef struct GE {
  int to;
  long long w;
} GE;
int n;
long long I;
unordered_map<long long, int> um;
int main() {
  scanf("%d %lld", &n, &I);
  I *= 8ll;
  vector<long long> A;
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    A.push_back(x);
    um[A[i]]++;
  }
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  int asz = A.size();
  long long lgK = I / n + 1;
  while (lgK * n > I) lgK--;
  long long mxK = 1ll << lgK;
  if (lgK >= 20) mxK = n;
  if (mxK >= asz) {
    puts("0");
    return 0;
  }
  int L = 0, R = mxK - 1;
  long long sum = 0;
  for (int i = 0; i < mxK; i++) {
    sum += um[A[i]];
  }
  long long ans = n - sum;
  while (R < asz) {
    L++;
    R++;
    if (R >= asz) break;
    sum -= um[A[L - 1]];
    sum += um[A[R]];
    ans = min(ans, n - sum);
  }
  printf("%lld", ans);
  return 0;
}
