#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  m = (8 * m) / n;
  m = pow(2, min(m, 20LL));
  map<long long, int> arr;
  for (int i = 0; i < n; i++) {
    long long p;
    cin >> p;
    arr[p]++;
  }
  int ans = INT_MAX;
  if (arr.size() <= m) {
    cout << 0 << "\n";
    return 0;
  }
  auto l = arr.begin();
  auto r = l;
  int left = 0;
  int right = 0;
  for (int i = 0; i < m; i++) {
    right += r->second;
    r++;
  }
  right = n - right;
  while (r != arr.end()) {
    ans = min(ans, left + right);
    left += l->second;
    l++;
    right -= r->second;
    r++;
  }
  cout << ans;
}
