#include <bits/stdc++.h>
using namespace std;
int n, I, arr[400007];
vector<int> v, v1, v2;
int main() {
  scanf("%d%d", &n, &I);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  sort(arr, arr + n);
  I *= 8;
  int cnt = 1;
  for (int i = 0; i < n; i++) {
    if (i && arr[i] == arr[i - 1])
      v.back()++;
    else
      v.push_back(1);
  }
  for (int i = 0; i < v.size(); i++) {
    v1.push_back(v[i]);
    v2.push_back(v[i]);
  }
  for (int i = 0; i < v.size(); i++) {
    if (i) v1[i] += v1[i - 1];
  }
  for (int i = v.size() - 1; i >= 0; i--) {
    if (i != v.size() - 1) v2[i] += v2[i + 1];
  }
  for (int i = v.size(); i >= 1; i--) {
    int x;
    x = ceil(log2(i));
    x *= n;
    if (x <= I) {
      I = i;
      break;
    }
  }
  int maxx = INT_MAX;
  for (int i = 0, j = I - 1; j < v.size(); i++, j++) {
    cnt = 0;
    if (i) cnt += v1[i - 1];
    if (j + 1 < v.size()) cnt += v2[j + 1];
    maxx = min(cnt, maxx);
  }
  printf("%d\n", maxx);
  return 0;
}
