There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors.  Find the number of the possible ways to paint the balls.
N , K = map(int,input().split())
result = 1
for i in range(N):
    if i == 0:
        result = K
    else:
        result *= (K - 1)
        print(result)
print(result)

N , K = map(int,input().split())
result = 1
for i in range(N):
    if i == 0:
        result = K
    else:
        result *= (K - 1)
print(result)
