#include<cstdio>
#include<cstring>
using namespace std;
int n,m,hs[100007];
bool pd[100007];
int hash(int x){
int t=x%100007;
while(pd[t]&&hs[t]!=x)t=(t+1)%100007;
pd[t]=1;
return t;
}
int main(){
memset(pd,0,sizeof(pd));
scanf("%d %d",&n,&m);
for(int i=1;i<=n;i++){
int t;scanf("%d",&t);
hs[hash(t)]=t;
}
for(int i=1;i<=m;i++){
int t;scanf("%d",&t);
if(hs[hash(t)]==t)printf("YES\n");
else printf("NO\n");
}
return 0;
}
阅读全文