#include <bits/stdc++.h>
using namespace std;
long long p(long long pw) {
  if (pw == 0) return 1;
  long long ans = 1;
  long long into = 2;
  while (pw) {
    if (pw & 1) ans *= into;
    into *= into;
    pw >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long n, tot;
  cin >> n >> tot;
  tot *= 8;
  long long k = tot / n;
  k = p(min(20LL, k));
  vector<long long> v(n);
  map<long long, long long> fre;
  for (auto &in : v) {
    cin >> in;
    fre[in]++;
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  long long cnt = v.size() - k;
  if (cnt <= 0)
    cout << 0 << endl;
  else {
    long long f = -1, l;
    long long ans = 0;
    vector<long long> x;
    for (int i = 0; i < v.size(); i++) {
      x.push_back(fre[v[i]]);
      if (x.size() != 1) x[x.size() - 1] += x[x.size() - 2];
    }
    long long mn = 1e9;
    while (true) {
      f++;
      l = f + k - 1;
      if (l >= v.size()) break;
      if (f > 0)
        mn = min(mn, x[f - 1] + x[x.size() - 1] - x[l]);
      else
        mn = min(mn, x[x.size() - 1] - x[l]);
    }
    cout << mn << endl;
  }
}
