#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, x;
  cin >> n >> x;
  x *= 8;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  int c = 1;
  vector<int> c1(0);
  c1.push_back(1);
  for (int i = 1; i < n; ++i) {
    if (v[i] != v[i - 1]) {
      c++;
      c1.push_back(1);
    } else {
      c1[(int)c1.size() - 1]++;
    }
  }
  int r = x / n;
  if (r > 20) {
    cout << 0;
    return 0;
  }
  if (pow(2, r) >= c) {
    cout << 0;
    return 0;
  }
  r = pow(2, r);
  int start = 0;
  long long sum = 0;
  long long min1;
  for (int i = 0; i < c - r; ++i) {
    sum += c1[i];
  }
  min1 = sum;
  int si = c1.size();
  for (int i = 0; i < si - r; ++i) {
    if (c - r - i - 1 < 0) break;
    sum -= c1[c - r - i - 1];
    sum += c1[c - i - 1];
    min1 = min(min1, sum);
  }
  cout << min1;
  return 0;
}
