#include <bits/stdc++.h>
using namespace std;
template <typename T, typename Pr = less<T>>
using pq = priority_queue<T, vector<T>, Pr>;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
class Mapping {
 public:
  void init(const vector<int>& raw, int base = 0) {
    start = base;
    arr = raw;
    sort(arr.begin(), arr.end());
    arr.erase(unique(arr.begin(), arr.end()), arr.end());
  }
  int get_idx(int k) {
    return start + (lower_bound((arr).begin(), (arr).end(), k) - arr.begin());
  }
  int get_value(int idx) { return arr[idx - start]; }
  int size() { return arr.size(); }

 private:
  int start;
  vector<int> arr;
};
int cnt[800005];
int cntr[800005];
int main() {
  int n, l;
  scanf("%d %d", &n, &l);
  vector<int> arr(n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  Mapping m;
  m.init(arr, 1);
  for (int i = 0; i < n; i++) {
    cnt[m.get_idx(arr[i])]++;
    cntr[m.get_idx(arr[i])]++;
  }
  int maxb = 0;
  int bv = 1;
  while (bv < n) {
    maxb++;
    bv *= 2;
  }
  l = (l * 8) / n;
  if (l >= maxb) {
    printf("0\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) cnt[i] += cnt[i - 1];
  for (int i = n; i >= 1; i--) cntr[i] += cntr[i + 1];
  int ans = 987654321;
  int use = 1;
  while (l > 0) {
    use = (use * 2);
    l--;
  }
  for (int i = 1; i <= n; i++) {
    int now = cnt[i - 1] + cntr[i + use];
    ans = min(ans, now);
  }
  printf("%d\n", ans);
  return 0;
}
