s = input().split() m = int(s[0]) n = int(s[1]) mod = 10 ** 9 + 7 print(mod) print(pow(m, n, mod))