#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:32000000")
#pragma GCC optimize("O3")
using namespace std;
int n, I;
long long arr[400005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cout.precision(8);
  srand(time(0));
  cin >> n >> I;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  int power = 8 * I / n;
  long long len = 1;
  for (int i = 0; i < power && len <= 1e9; i++) {
    len *= 2;
  }
  int ans = 1000000007;
  int t = 1;
  for (int l = 0, r = 0; l < n; l++) {
    if (l && arr[l] != arr[l - 1]) {
      t--;
    }
    while (r + 1 < n && t < len || (t == len && arr[r] == arr[r + 1])) {
      t += arr[r] != arr[r + 1];
      r++;
    }
    ans = min(ans, n - (r - l + 1));
  }
  cout << ans;
  return 0;
}
