MP3
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=4e5+10; int n; ll I; int c[maxn]; int res=0x3f3f3f3f; int main() { freopen("1.txt","r",stdin); scanf("%d%d",&n,&I); for(register int i=1;i<=n;++i){ scanf("%d",c+i); } sort(c+1,c+1+n); I=(I*8)/n; I=I>30?(1<<30):(1<<I); int l=1,r=1; int sum=1; while (r<=n){ while (sum>I){ l++; if(c[l]!=c[l-1]){ sum--; } } res=min(res,n-(r-l+1)); r++; if(c[r]!=c[r-1])sum++; } printf("%d\n",res); return 0; }