#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v;
map<long long, long long> m;
int qpow(long long a, long long b, long long m) {
  long long c = 1;
  while (b) {
    if (b & 1) c = c * a % m;
    b >>= 1;
    a = a * a % m;
  }
  return c;
}
int main() {
  ios::sync_with_stdio(false);
  long long num, n, s, t;
  cin >> n >> s;
  if (8 * s / n < 63) {
    num = pow(2, 8 * s / n);
  } else {
    num = 0x7fffffffffffffff;
  }
  for (int i = (0); i < (n); ++i) {
    cin >> t;
    if (m.count(t) == 0) {
      v.push_back(make_pair(t, 0));
      m[t] = 1;
    } else {
      m[t]++;
    }
  }
  int len = v.size();
  for (int i = (0); i < (len); ++i) {
    v[i].second = m[v[i].first];
  }
  sort(v.begin(), v.end());
  long long l = -1, r = len;
  long long ans = 0;
  while (l < r && len > num) {
    l++;
    ans += v[l].second;
    len--;
  }
  long long minn = ans;
  while (l >= 0) {
    if (l >= r) {
      cout << n;
      return 0;
    }
    ans -= v[l].second;
    len++;
    l--;
    while (len > num) {
      r--;
      ans += v[r].second;
      len--;
    }
    minn = min(ans, minn);
  }
  cout << minn;
  return 0;
}
