#include <bits/stdc++.h>
using namespace std;
int main() {
  long double n, I;
  cin >> n >> I;
  long long b = I * 8;
  long long h = b / n;
  long long a[400005];
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  long long ans = 0, k = mp.size();
  h = min(62LL, h);
  long long g = (long long)(pow(2LL, h));
  if (g >= k) {
    cout << 0;
    return 0;
  }
  long long i = 1;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    a[i] = itr->second;
    i++;
  }
  for (i = 1; i < g; i++) ans += a[i];
  long long maxm = 0;
  for (int j = i; j <= k; j++) {
    ans += a[j];
    maxm = max(maxm, ans);
    ans -= a[j - g + 1];
  }
  cout << n - maxm;
}
