A, N = map(int, input().split()) M = 1 print(M) print(pow(A,N,M)) print("\n")