#include <bits/stdc++.h>
using namespace std;
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int64_t n, I, i, ans, temp;
  cin >> n >> I;
  int64_t arr[n + 1];
  map<int64_t, int64_t> cnt;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    cnt[arr[i]]++;
  }
  queue<int64_t> q;
  ans = 0;
  I *= 8;
  I /= n;
  temp = 0;
  I = pow(2, I);
  for (auto j : cnt) {
    if (q.size() == I) {
      temp -= cnt[q.front()];
      q.pop();
    }
    q.push(j.first);
    temp += j.second;
    ans = max(ans, temp);
  }
  cout << n - ans << endl;
  return 0;
}
