#include <bits/stdc++.h>
using namespace std;
int wait;
const double pi =
    3.14159265358979323846264338327950288419716939937510582097494459;
const double EPS = 1e-12;
const int MAXN = 1e5 + 10;
const long long MOD = 1e9 + 7;
const long long Mod = 1e9 + 7;
const long long mod = 1e9 + 7;
const int MAX = 5e6 + 5;
const int oo = 2e9 + 10;
const long long OO = 1e18;
const int N = 2e5 + 5;
const int logN = (int)(log2(N));
int dx[] = {0, 1, 0, -1, -1, -1, 1, 1};
int dy[] = {1, 0, -1, 0, -1, 1, -1, 1};
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); }
long long arr[6 * N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, I;
  cin >> n >> I;
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long bits = 8LL * I / n;
  map<long long, long long> freq;
  for (int i = 0; i < n; i++) freq[arr[i]]++;
  vector<pair<long long, long long> > vec;
  for (auto x : freq) vec.push_back({x.first, x.second});
  if (n * (long long)ceil(log2(vec.size())) <= 8LL * I) {
    cout << 0 << endl;
    return 0;
  }
  long long K = (1 << bits);
  long long ans = OO;
  long long cnt = 0;
  for (int i = 0; i < K; i++) cnt += vec[i].second;
  for (int i = 0; i < vec.size(); i++) {
    ans = min(n - cnt, ans);
    cnt -= vec[i].second;
    if (i + K < vec.size()) cnt += vec[i + K].second;
  }
  cout << ans << endl;
}
