#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  int n, i;
  cin >> n >> i;
  int A[n];
  int prefix[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  sort(A, A + n);
  int k = (8 * i) / n;
  int K = pow(2, min(k, 20));
  vector<int> c;
  int co = 0;
  for (int i = 0; i < n; i++) {
    if (i > 0 && A[i] != A[i - 1]) {
      c.push_back(co);
      co = 1;
    } else
      co++;
  }
  c.push_back(co);
  int l = c.size();
  if (l <= K)
    cout << 0 << endl;
  else {
    int prefix[l];
    prefix[0] = c[0];
    int ans = INT_MAX;
    for (int i = 1; i < l; i++) prefix[i] = prefix[i - 1] + c[i];
    for (int i = K - 1; i < l; i++) {
      int curr = 0;
      if (i - K >= 0) curr += prefix[i - K];
      if (i < l - 1) curr += prefix[l - 1] - prefix[i];
      ans = min(ans, curr);
    }
    cout << ans << endl;
  }
}
