#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
map<int, int> mp;
map<int, int>::iterator it;
int a[maxn];
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  t = t * 8 / n;
  if (t >= 20) {
    printf("0\n");
    return 0;
  }
  t = (1 << t);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    mp[a[i]]++;
  }
  int cnt = 0;
  for (it = mp.begin(); it != mp.end(); it++) {
    a[cnt++] = (*it).second;
  }
  if (cnt <= t) {
    printf("0\n");
    return 0;
  }
  int ans = 0;
  for (int i = 0; i < t; i++) {
    ans += a[i];
  }
  int tmp = ans;
  for (int i = 1; i + t - 1 < cnt; i++) {
    tmp -= a[i - 1];
    tmp += a[i + t - 1];
    ans = max(ans, tmp);
  }
  printf("%d\n", n - ans);
}
