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