#include <bits/stdc++.h>
const int kMaxn = 4e5 + 10;
using namespace std;
int a[kMaxn], s[kMaxn] = {0}, unq[kMaxn][2];
int N, I, Ans;
int main() {
  cin >> N >> I;
  for (register int i = 1; i <= N; ++i) cin >> a[i];
  int n = 1;
  sort(a + 1, a + N + 1);
  unq[1][0] = a[1];
  unq[1][1]++;
  for (register int i = 1, j = 1; i < N;) {
    if (a[i] != a[++j]) i = j, unq[++n][0] = a[i];
    unq[n][1]++;
  }
  int k = I * 8 / N;
  int maxK = pow(2, min(20, k));
  if (maxK >= n) return cout << 0, 0;
  for (register int i = 1; i <= n; ++i) s[i] = s[i - 1] + unq[i][1];
  Ans = 1e9;
  for (register int i = 1; i + maxK - 1 <= n; ++i)
    Ans = min(Ans, N - s[i + maxK - 1] + s[i - 1]);
  printf("%d\n", Ans);
  return 0;
}
