#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e5 + 5;
const int MAXM = 2e5 + 5;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
int a[MAXN], sum[MAXN];
vector<int> v;
map<int, int> mp;
int main() {
  int n, I;
  scanf("%d%d", &n, &I);
  mp.clear();
  memset(sum, 0, sizeof(sum));
  int B = I * 8;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    if (mp.find(a[i]) == mp.end()) {
      mp[a[i]] = 1;
    } else {
      ++mp[a[i]];
    }
    v.emplace_back(a[i]);
  }
  sort(a + 1, a + n + 1);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  int sz = v.size(), K;
  for (int i = sz; i >= 1; --i) {
    if (n * int(ceil(log2(i))) <= B) {
      K = i;
      break;
    }
  }
  for (int i = 0; i < sz; ++i) {
    if (i == 0)
      sum[i] = mp[v[i]];
    else
      sum[i] = sum[i - 1] + mp[v[i]];
  }
  int ans = n, tmp = 0;
  for (int i = 0; i <= max(sz - K, 0); ++i) {
    tmp = 0;
    if (i != 0) tmp += sum[i - 1];
    tmp += sum[sz - 1] - sum[min(i + K - 1, sz - 1)];
    ans = min(tmp, ans);
  }
  printf("%d\n", ans);
  return 0;
}
