#include #include using namespace std; int main(){ int x,n; scanf("%d %d",&x,&n); int a[n]; int mod[1000002];//x^i mod 1000003 for(int i=0;i