#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const long long INF = 1e18;
const double eps = 1e-6;
const int maxn = 4e5 + 5;
map<long long, long long> mp;
long long n, I, K, k, idx, a, b[maxn], sum[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> I;
  for (int i = 1; i <= n; ++i) {
    cin >> a;
    if (!mp[a]) b[++idx] = a;
    ++mp[a];
  }
  K = pow(2, min(19 * 1LL, 8 * I / n));
  if (K >= idx) {
    cout << 0 << endl;
    return 0;
  }
  sort(b + 1, b + 1 + idx);
  for (int i = 1; i <= idx; ++i) sum[i] = sum[i - 1] + mp[b[i]];
  long long res = INF;
  for (int i = 1; i + K - 1 <= idx; ++i) {
    res = min(res, (sum[i - 1] - sum[0]) + (sum[idx] - sum[i + K - 1]));
  }
  cout << res << endl;
  return 0;
}
