#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, I, K, bits;
  cin >> n >> I;
  map<int, int> cnt;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    cnt[tmp]++;
  }
  vector<pair<int, int> > sum(cnt.begin(), cnt.end());
  for (unsigned int i = 1; i < sum.size(); i++) {
    sum[i].second += sum[i - 1].second;
  }
  bits = 8 * I / n;
  if (bits >= 32) {
    cout << 0 << endl;
    return 0;
  }
  K = pow(2, bits);
  if (K >= (int)sum.size()) {
    cout << 0 << endl;
    return 0;
  }
  int ans = sum[K - 1].second;
  for (int i = 1; i + K - 1 < (int)sum.size(); i++) {
    ans = max(ans, sum[i + K - 1].second - sum[i - 1].second);
  }
  cout << n - ans << endl;
  return 0;
}
