#include using namespace std; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a vector compress(vector v){ sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); return v; } //INSERT ABOVE HERE const int BS = 100000; const int MOD = 100003; unsigned xor128_x = 123456789, xor128_y = 362436069, xor128_z = 521288629, xor128_w = 88675123; unsigned xor128() { unsigned t = xor128_x ^ (xor128_x << 11); xor128_x = xor128_y; xor128_y = xor128_z; xor128_z = xor128_w; return xor128_w = xor128_w ^ (xor128_w >> 19) ^ (t ^ (t >> 8)); } vector generateA(int N) { vector A(N); for(int i = 0; i < N; ++ i) A[i] = xor128() % MOD; return A; } signed main(){ int n,q; cin>>n>>q; auto a=generateA(n); using ll = long long; a=compress(a); n=a.size(); if(n<=BS){ while(q--){ ll x; cin>>x; ll res=0; for(int y:a) chmax(res,x*y%MOD); cout<ll{ ll n=MOD-2,res=1; while(n){ if(n&1) res=res*x%MOD; x=x*x%MOD; n>>=1; } return res; }; vector exist(MOD,0); for(int y:a) exist[y]=1; vector memo(MOD,-1); while(q--){ ll x; cin>>x; ll &res=memo[x]; if(~res){ cout<