#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 7;
const int inf = 0x3f3f3f3f;
int arr[maxn];
map<int, int> tran;
int main() {
  ios::sync_with_stdio(false);
  long long n, I;
  cin >> n >> I;
  I *= 8;
  I /= n;
  long long num = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    if (!tran[arr[i]]) num++;
    tran[arr[i]]++;
  }
  num = (long long)ceil(log2(num));
  long long minn = inf;
  if (num <= I)
    cout << 0 << endl;
  else {
    I = pow(2, I);
    sort(arr + 1, arr + 1 + n);
    int tail = unique(arr + 1, arr + 1 + n) - (arr + 1);
    long long now = 0;
    for (int i = I + 1; i <= tail; i++) now += tran[arr[i]];
    minn = now;
    int i = 1, j = I;
    while (j < tail) {
      now += tran[arr[i]];
      i++, j++;
      now -= tran[arr[j]];
      minn = min(now, minn);
    }
    cout << minn << endl;
  }
  return 0;
}
