#include <bits/stdc++.h>
using namespace std;
void solve(void);
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
long long int power(long long int x, long long int y) {
  long long int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else {
    return x * temp * temp;
  }
}
long long int calculateK(long long int n, long long int i) {
  long long int pow = (long long int)i / n;
  return power(2, pow);
}
void solve(void) {
  long long int n, i;
  cin >> n;
  cin >> i;
  i *= 8;
  vector<int> record(n);
  vector<int> num;
  unordered_map<int, long long int> hash;
  int distinct = 0;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    record[i] = temp;
    if (hash[temp] == 0) {
      hash[temp] = 1;
      distinct++;
      num.push_back(temp);
    } else {
      hash[temp] = hash[temp] + 1;
    }
  }
  long long int maxK = calculateK(n, i);
  sort(num.begin(), num.end());
  long long int sum = 0;
  for (int i = 0; i < maxK && i < num.size(); i++) {
    sum += hash[num[i]];
  }
  long long int maxSum = sum, maxL = 0,
                maxR = maxK < num.size() ? maxK - 1 : num.size() - 1;
  for (int i = maxK, j = 1; i < num.size(); i++, j++) {
    sum -= hash[num[j - 1]];
    sum += hash[num[i]];
    if (sum > maxSum) {
      maxSum = sum;
      maxL = j;
      maxR = i;
    }
  }
  int valL = num[maxL];
  int valR = num[maxR];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (record[i] < valL || record[i] > valR) {
      ans++;
    }
  }
  cout << ans << endl;
}
