a,n = map(int,input().split()) i = 0 while i < n: i += 1 if a**i >= 10**7: break if i == n: print(10**7) print(a**n) else: print(a**i) print(0)