#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long arr[a];
  for (long long i = 0; i < a; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + a);
  vector<long long> vec;
  vector<long long> sum;
  map<long long, long long> M;
  for (long long i = 0; i < a; i++) {
    M[arr[i]]++;
    if (M[arr[i]] == 1) {
      vec.push_back(arr[i]);
    }
  }
  sum.push_back(0);
  for (long long i = 0; i < vec.size(); i++) {
    sum.push_back(M[vec[i]] + sum[i]);
  }
  long long kmin = 1, kmax = a + 1;
  while (kmax - kmin > 1) {
    long long k = (kmin + kmax) / 2;
    long long g = 1;
    long long r = 0;
    while (g < k) {
      g *= 2;
      r++;
    }
    if (a * r > 8 * b) {
      kmax = k;
    } else {
      kmin = k;
    }
  }
  if (kmin >= vec.size()) {
    cout << "0" << endl;
    return 0;
  }
  long long x = 0;
  for (long long i = 0; i <= vec.size() - kmin; i++) {
    x = max(x, sum[i + kmin] - sum[i]);
  }
  cout << sum[vec.size()] - x << endl;
}
