#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 10;
int a[maxn], b[maxn];
int sum[maxn];
int main() {
  int n, I;
  scanf("%d%d", &n, &I);
  a[0] = -1;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] != a[i - 1]) cnt++;
    b[cnt]++;
  }
  for (int i = 1; i <= cnt; i++) sum[i] = sum[i - 1] + b[i];
  int k = 1;
  for (int i = 0; i < I * 8 / n; i++) {
    k <<= 1;
    if (k >= cnt) break;
  }
  k = min(k, cnt);
  int ans = 0;
  for (int i = k; i <= cnt; i++) ans = max(ans, sum[i] - sum[i - k]);
  printf("%d\n", n - ans);
  return 0;
}
