#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 9;
signed main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;
  long long n, I, temp, ans = 0;
  cin >> n >> I;
  map<long long, long long> mp;
  I = I * 8;
  for (long long i = 0; i < n; i++) {
    cin >> temp;
    mp[temp]++;
  }
  vector<long long> a;
  long long k = pow(2LL, min(25LL, I / n));
  long long u = mp.size();
  if (k >= u) {
    cout << 0 << '\n';
    return 0;
  }
  a.push_back(0);
  for (auto z : mp) a.push_back(z.second);
  vector<long long> pref(u + 1);
  pref[0] = 0;
  for (long long i = 1; i <= u; i++) {
    pref[i] = pref[i - 1] + a[i];
  }
  long long sum = 0, index;
  for (long long i = 0; i <= u - k; i++) {
    if (sum < pref[i + k] - pref[i]) {
      index = i + 1;
      sum = pref[i + k] - pref[i];
    }
  }
  for (long long i = 1; i < index; i++) ans += a[i];
  for (long long i = index + k; i <= u; i++) ans += a[i];
  cout << ans;
  return 0;
}
