#include #include #include #include #include #include using namespace std; #define N 2000005 const int inf=100000000; int h[N]; int a[N],cnt[N]; int n,m; int len; void inti() { int i,j; sort(h,h+n); memset(cnt,0,sizeof(cnt)); cnt[0]=1; len=0; for(i=1;i>1; if(h[mid]==x) { break; } if(h[mid]>x) r=mid-1; else l=mid+1; } if(h[mid]==x) { ans=cnt[mid]; cnt[mid]=0; return ans; } else return 0; } int main() { int i,q,t; while(~scanf("%d%d",&n,&m)) { for(i=0;i