#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
const int MAXN=20000000;
bool isPrime[MAXN],notPrime[MAXN];
void initPrime(int x){
notPrime[0]=1;
notPrime[1]=1;
for(int i=2;i<=sqrt(x);i++){
if(notPrime[i])continue;
for(int j=i;j<=x/i;j++){
notPrime[i*j]=1;
}
}
}
int main(){
int n,m;
scanf("%d%d",&n,&m);
initPrime(n);
for(int i=1;i<=m;i++){
int val;
scanf("%d",&val);
if(notPrime[val])printf("No
");
else printf("Yes
");
}
return 0;
}