#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define tcl(a,b,c) for(a=b;a<=c;a++)
bool isprime[10000001];
int p[10000001];
void sieve(int n)//埃式筛法
{
p[1]=0;
isprime[1]=true;
for(int i=2;i<=n;i++)
{
if(isprime[i]==false)
{
p[i]= p[i-1]+1;
for(int j=i+i;j<=n;j=j+i)
{
isprime[j]=true;
}
}
else p[i]= p[i-1];
}
}
int main()
{
int a,b,x,y,i;
scanf("%d%d",&a,&b);
sieve(a);
tcl(i,1,b)
{
scanf("%d",&x);
if(isprime[x]!=true) printf("Yes
");
else printf("No
");
}
return 0;
}