#include #include #include #include using namespace std; typedef long long int ll; 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)); } void generateA(int N, int A[]) { for(int i = 0; i < N; ++ i) A[i] = xor128() % 100003; } ll mod=100003; ll n,q,a[100030]; ll has[100030]; ll Power(ll a,ll b){ a%=mod; if(b==0)return 1; if(b==1)return a; ll res=Power(a,b/2); res%=mod; res*=res; res%=mod; if(b%2==1)res*=a; res%=mod; return res; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cin >> n >> q; for(int i=0;i> x; if(x==0){ cout << 0 << endl; continue; } if(n<=100){ ans=0; for(int i=0;i=0;ans--){ if(has[ans*rev%mod])break; } } cout << ans << endl; } }