#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
long long a[maxn];
long long pre[maxn];
map<long long, long long> mp;
int main() {
  int n, l;
  scanf("%d%d", &n, &l);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
    mp[a[i]]++;
  }
  sort(a, a + n);
  long long cnt = unique(a, a + n) - a;
  for (int i = 1; i <= cnt; i++) {
    pre[i] = pre[i - 1] + mp[a[i - 1]];
  }
  l *= 8;
  long long temp = log(cnt) / log(2);
  if ((1 << temp) < cnt) temp++;
  if (temp * n <= l) {
    printf("0\n");
    return 0;
  }
  long long sum = l / n;
  sum = (1 << sum);
  long long ans = -0x3f3f3f3f;
  for (int i = 1, j = i + sum; j <= cnt; i++, j++) {
    ans = max(ans, pre[j] - pre[i]);
  }
  printf("%I64d\n", n - ans);
  return 0;
}
