1 #include<cstdio>
2 #include<iostream>
3
4 using namespace std;
5
6 int n, m;
7 int cnt;
8 int prime[10000005], vis[10000005];
9
10 inline void is_prime(){
11 for(int i = 2; i <= n; i++){
12 if(!vis[i]) prime[++cnt] = i;
13 for(int j = 1; j <= cnt; j++){
14 if(i * prime[j] > n) break;//判断是否越界
15 vis[i*prime[j]] = 1;//已访问
16 if(i % prime[j] == 0) break;//欧拉筛核心
17 }
18 }
19 }
20
21 int main(){
22 scanf("%d%d", &n, &m);
23 is_prime();
24 vis[1] = vis[0] = 1;
25 int z;
26 for(int i = 1; i <= m; i++){
27 scanf("%d", &z);
28 if(vis[z]) printf("No
");
29 else printf("Yes
");
30 }
31 return 0;
32 }