def main(): a, n = map(int, input().split()) mod = 10 ** 9 + 7 print(mod) ans = pow(a, n, mod) print(ans) if __name__ == "__main__": main()