#include<iostream> #include<map> #include<algorithm> #include<cstring> #include<cmath> usingnamespace std; typedeflonglong ll; constint N = 4e5 + 10; constint inf = 0x3f3f3f3f; int n, I; ll a[N], b[N], pre[N]; ll count(ll l ,ll r){ return pre[r] - pre[l-1]; } boolcheck(ll l, ll r){ int k = r - l + 1; returnceil(log2(k)) * n <= I * 8; } intmain(){ ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n >> I; for (int i = 1; i <= n; i++) { cin >> a[i]; b[i] = a[i]; } sort(a+1, a+1+n); sort(b+1, b+1+n); ll m = unique(b+1, b+1+n) - b - 1; for (int i = 1; i <= n; i++) a[i] = lower_bound(b+1, b+1+m, a[i]) - b; for (int i = 1; i <= n; i++) { pre[a[i]]++; } for (int i = 1; i <= n; i++) { pre[i] += pre[i-1]; } ll ans = inf; for (int i = 1; i <= m; i++) { ll l = i, r = m, mid; while (l < r) { mid = (l + r + 1) >> 1; if (check(i, mid)) { l = mid; } else { r = mid - 1; } } if (check(i, l)) { ans = min(ans, n - count(i, l)); } } cout << ans << endl; return0; }