#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& n) {
  T X = 0, w = 1;
  char ch = -1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    X = (X << 3) + (X << 1) + ch - '0';
    ch = getchar();
  }
  n = X * w;
}
long long qpow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (ret > 0x3f3f3f3f || a > 0x3f3f3f3f) return 0x3f3f3f3f;
    if (b & 1) ret = (a * ret);
    a = (a * a);
    b >>= 1;
  }
  return ret;
}
const int N = 5e5 + 10;
long long arr[N], hx[N];
long long num[N], dp[N];
int main() {
  long long n, I;
  read(n), read(I);
  for (int i = 1; i <= n; ++i) read(arr[i]), hx[i] = arr[i];
  sort(hx + 1, hx + 1 + n);
  int l = unique(hx + 1, hx + 1 + n) - hx;
  for (int i = 1; i <= n; ++i) {
    int now = lower_bound(hx + 1, hx + l, arr[i]) - hx;
    num[now]++;
  }
  I <<= 3;
  I /= n;
  int j = 1;
  for (int i = l - 1; i > 0; --i) dp[i] = dp[i + 1] + num[i];
  long long ans = 0x3f3f3f3f;
  long long tot = 0;
  I = qpow(2, I);
  for (int i = 1; i < l; i++) {
    if (i + I <= l)
      ans = min(ans, tot + dp[i + I]);
    else
      ans = min(ans, tot);
    tot += num[i];
  }
  cout << ans << endl;
  return 0;
}
