yan奇奇是个大傻傻(づ ̄ 3 ̄)づ
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
typedef long long ll;
const int maxn = 4e5+20;
using namespace std;
int n,I;
int a[maxn];
void solve(){
map<int,int>q;
sort(a + 1 , a + 1 + n);
ll m = 8ll * (ll)I / (ll)n;
if(m > 30) m = 30;
m = 1ll<<m; //中间那个序列里面最多能有多少数
int ans = n, cnt = 0;
//尺取法
int l = 1, r = 1;
while(l <= n){
while((cnt < m || q[a[r]]) && (r <= n)){
if(!q[a[r]]) cnt++;
q[a[r]]++;
r++;
}
ans = min(ans,n - (r - l));
q[a[l]]--;
if(!q[a[l]]) cnt--;
l++;
}
printf("%d\n",ans);
}
int main(){
while(~scanf("%d%d",&n,&I)){
for(int i = 1 ; i <= n ;i++){
scanf("%d",&a[i]);
}
solve();
}
return 0;
}