#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, I;
  cin >> n >> I;
  I *= 8;
  map<int, int> m;
  for (int i = 0; i < n; ++i) {
    int k;
    cin >> k;
    m[k]++;
  }
  int k = I / n;
  int p = 0;
  int mn = max(0, (int)m.size() - (1 << min(k, 30)));
  vector<int> v;
  for (auto x : m) {
    v.push_back(x.second);
  }
  vector<int> lv(m.size() + 1, 0), rv(m.size() + 1, 0);
  n = m.size();
  for (int i = 0; i < n; ++i) {
    lv[i + 1] = lv[i] + v[i];
    rv[n - i - 1] = rv[n - i] + v[n - i - 1];
  }
  int ans = 1e9;
  for (int i = 0; i < n; ++i) {
    int j = min(n, i + n - mn);
    ans = min(ans, lv[i] + rv[j]);
  }
  cout << ans << '\n';
}
