#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, s, x, k, ans = 0, ch = 0;
  cin >> n >> s;
  s = 8 * s;
  vector<long long int> vec(n);
  vector<pair<long long int, long long int>> dat;
  for (long long int i = 0; i < n; i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  dat.push_back(make_pair(vec[0], 1));
  x = vec[0];
  for (long long int i = 1; i < n; i++) {
    if (vec[i] != x) {
      dat.push_back(make_pair(vec[i], 1));
      x = vec[i];
    } else {
      dat[dat.size() - 1].second++;
    }
  }
  while (1) {
    k = 0;
    while (pow(2, k) < dat.size() - ch) k++;
    k = n * k;
    if (k <= s) break;
    ch++;
  }
  x = 0;
  for (long long int i = 0; i < ch; i++) x = x + dat[i].second;
  ans = x;
  for (long long int i = 0; i < ch; i++) {
    x = x - dat[ch - i - 1].second + dat[dat.size() - i - 1].second;
    if (x < ans) ans = x;
  }
  cout << ans << endl;
}
