#include<iostream>
#include<cstdio>
using namespace std;
int num[10000010]={1,1};
int main()
{
for(int i=2;i<=5000000;i++){
if(!num[i])
for(int j=2;j*i<=10000000;j++)
num[j*i]=1;
}
int n,m,q;
cin>>n>>m;
while(m--)
{
scanf("%d",&q);
if(num[q])printf("No\n");
else printf("Yes\n");
}
return 0;
}