a,n = map(int,input().split()) MOD = 10**9+7 print(MOD) print(pow(a,n,MOD))