#include "testlib.h" #include #include #include using namespace std; using ll=long long; const ll MAXN=1000000000000000000ll; const int MAXK=10000; const int MAXQ=100000; int main(int argc, char* argv[]){ registerValidation(argc, argv); int k=inf.readInt(2, MAXK); inf.readSpace(); int q=inf.readInt(1, MAXQ); inf.readEoln(); ll n[100010]; for(int i=0; i v{1}; while(v.back()<=MAXN){ v.push_back(v.back()+(v.back()+k-2)/(k-1)); } for(int i=0; i