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