#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int read() {
  int v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
long long readll() {
  long long v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
map<int, int> mp;
pair<int, int> a[444444];
int n, I;
void predo() {}
void init() {
  n = read(), I = read();
  mp.clear();
  for (int i = (int)1; i <= (int)n; i++) {
    int x = read();
    mp[x]++;
  }
}
void solve() {
  int m = 0;
  for (auto t : mp) a[++m] = t;
  sort(a + 1, a + m + 1);
  long long k = 8ll * I / n;
  int K = 1;
  for (int i = (int)1; i <= (int)k; i++) {
    K = K * 2;
    if (K > m) {
      K = m;
      break;
    }
  }
  int s = 0;
  for (int i = (int)1; i <= (int)K; i++) s += a[i].second;
  int ans = s;
  for (int i = (int)2; i <= (int)m - K + 1; i++) {
    s -= a[i - 1].second;
    s += a[i + K - 1].second;
    ans = max(ans, s);
  }
  int tot = 0;
  for (int i = (int)1; i <= (int)m; i++) tot += a[i].second;
  printf("%d\n", tot - ans);
}
int main() {
  predo();
  int cas = 1;
  while (cas--) {
    init();
    solve();
  }
  return 0;
}
