#include <bits/stdc++.h>
namespace nt {
template <typename T, typename U>
T pow(T n, U p) {
  T res = 1;
  while (p > 0) {
    if (p % 2 == 1) {
      res *= n;
    }
    n *= n;
    p /= 2;
  }
  return res;
}
}  // namespace nt
int main() {
  int n, I;
  std::cin >> n >> I;
  std::vector<int> a(n);
  for (auto& e : a) {
    std::cin >> e;
  }
  std::sort(a.begin(), a.end());
  std::vector<int> kind;
  int pos = -1, num = 0;
  for (auto e : a) {
    if (pos != e) {
      if (num != 0) {
        kind.push_back(num);
      }
      pos = e;
      num = 1;
    } else {
      num++;
    }
  }
  if (num != 0) {
    kind.push_back(num);
  }
  int k = kind.size();
  for (int i = 1; i < k; i++) {
    kind[i] += kind[i - 1];
  }
  int b = 8 * I / n;
  int m = 1;
  for (int i = 0; i < b; i++) {
    m *= 2;
    if (m > 1e8) {
      break;
    }
  }
  m = std::min(m, k);
  int ans = n - kind[m - 1];
  for (int i = m; i < k; i++) {
    ans = std::min(ans, n - kind[i] + kind[i - m]);
  }
  std::cout << ans << std::endl;
  return 0;
}
