#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
vector<long long> v, prs;
long long lg(long long a) {
  long long res = 0;
  while (a > 1) {
    a = (a + 1) / 2;
    res++;
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, x;
  cin >> n >> x;
  x *= 8;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    if (!mp[a]) v.push_back(a);
    mp[a]++;
  }
  sort(v.begin(), v.end());
  long long s = 0;
  prs.push_back(0);
  for (long long i = 0; i < (long long)v.size(); i++) {
    s += mp[v[i]];
    prs.push_back(s);
  }
  long long y = 0;
  while ((lg((long long)v.size() - y) * n) > x) y++;
  long long ans = INT_MAX;
  for (long long i = 0; i <= y; i++)
    (ans) = min((ans), (prs[i] + (s - prs[(long long)v.size() - (y - i)])));
  cout << ans << endl;
  return 0;
}
