#include <bits/stdc++.h>
using namespace std;
mt19937 rng(int(chrono::steady_clock::now().time_since_epoch().count()));
class Solution {
 private:
  int N;
  int I;
  vector<int> v;

 public:
  Solution() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  void main() {
    cin >> N >> I;
    v.resize(N);
    set<int> s;
    for (int i = 0; i < N; i += 1) {
      cin >> v[i];
      s.insert(v[i]);
    }
    int size = 0;
    map<int, int> convert;
    for (const auto &i : s) {
      convert[i] = size;
      size += 1;
    }
    vector<int> sum(size, 0);
    for (int i = 0; i < N; i += 1) {
      sum[convert[v[i]]] += 1;
    }
    for (int i = 1; i < size; i += 1) {
      sum[i] += sum[i - 1];
    }
    int kappaloiro = 0;
    for (int i = 1; i <= N + 5; i += 1) {
      if (N * int(ceil(log2(i))) > 8 * I) {
        break;
      }
      kappaloiro = i;
    }
    int ans = 0;
    for (int i = 0; i < size; i += 1) {
      const int j = i - kappaloiro;
      ans = max(ans, sum[i] - ((j >= 0) ? sum[j] : 0));
    }
    cout << N - ans << endl;
  }
};
int main() {
  Solution().main();
  return 0;
}
