#include<bits/stdc++.h>
using namespace std;
const int N = 1e8+10;
int n,q;
bool book[N];
vector<int>ps;
bool ip(int a){
for(int i = 2;i*i <= a;i++)
if(a%i == 0) return 0;
return 1;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> q;
book[1] = true;
for(int i = 2;i*i <= n;i ++){
if(book[i]) continue;
else if(ip(i)){
ps.push_back(i);
for(int p = 2;p*i <= n;p ++){
book[i*p] = true;
}
}
}
for(int i = 1,k;i <= q;i ++){
cin >> k;
cout << ps[k-1] << endl;
}
return 0;
}
大佬们帮忙看看,为啥用vector全RE了,但是用普通数组AC了