def main(): m=10**9+7 a,n=map(int,input().split()) print(m) print(pow(a,n,m)) main()