#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int s;
  cin >> n >> s;
  long a[n];
  long k = exp2(min(8 * s / n, 20));
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  vector<int> counts;
  int last_num = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] != last_num) {
      counts.push_back(1);
      last_num = a[i];
    } else {
      counts.back() += 1;
    }
  }
  if (k > counts.size()) {
    cout << 0 << endl;
    return 0;
  }
  int sum = 0;
  for (int i = 0; i < k; i++) {
    sum += counts[i];
  }
  int best = sum;
  for (int i = k; i < counts.size(); i++) {
    sum += counts[i] - counts[i - k];
    best = max(sum, best);
  }
  cout << n - best << endl;
  return 0;
}
