Problem:
 Score : 200 points    Problem Statement 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.      Constraints  1≦N≦1000  2≦K≦1000  The correct answer is at most 2^{31}-1 .         Input The input is given from Standard Input in the following format:  N  K       Output Print the number of the possible ways to paint the balls.        Sample Input 1 2 2      Sample Output 1 2  We will denote the colors by 0 and 1 . There are two possible ways: we can either paint the left ball in color 0 and the right ball in color 1 , or paint the left in color 1 and the right in color 0 .       Sample Input 2 1 10      Sample Output 2 10  Since there is only one ball, we can use any of the ten colors to paint it. Thus, the answer is ten.

Solution (Python):
N,K=map(int,input().split())
print(K*(K-1)**(N-1))

Solution (Python):
N,K = [int(i) for i in input().split()]

ans = int(K*(K-1)**(N-1))

print(ans)

Solution (Python):
n,k = map(int,input().split())

print(k * ((k-1)**(n-1)))

Solution (Python):
n,k = map(int,input().split())

print(k*((k-1)**(n-1)))

Solution (Python):
n, k = map(int, input().split())
if n == 1:
    ans = k
else:
    ans = k
    for i in range(n-1):
        ans *= k-1
print(ans)

Solution (Python):
n,k = map(int,input().split())
if n==1:
    print(k)
else:
    ans = k
    for _ in range(n-1):
        ans *= (k-1)
    print(ans)

Solution (Python):
n, k = map(int, input().split())
print((k - 1) ** (n - 1) * k)

Solution (Python):
n, k = map(int, input().split())

print(k * (k - 1) ** (n - 1))

Solution (Python):
N, K = map(int, input().split())

ans = K * (K-1) ** (N-1)

print(ans)

Solution (Python):
N, K = map(int, input().split())

result = K
for i in range(N - 1):
    result *= K - 1
print(result)

Solution (Python):
N,K=map(int,input().split())
for i in range(N):
  if i==0:
    ans=K
  if i>0:
    ans*=(K-1)
print(ans)

Solution (Python):


N, K = map(int, input().split())

ans = ((K - 1) ** (N - 1)) * (K)
print(ans)

Solution (Python):

n, k = map(int,input().split()) 

print(k * pow(k-1, n-1))

Solution (Python):
N,K=map(int,input().split())
ans=K*((K-1)**(N-1))
print(ans)

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

print(ans)

Solution (Python):
n,k = map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):
n, k = list(map(int, input().split(' ')))

c = [k - 1] * 1000
c[0] = k
c = c[0:n]

result = 1
for i in c:
    result *= i

print(result)

Solution (Python):
n, k = map(int, input().split())

ans = k
for _ in range(n-1):
    ans *= (k - 1)

print(ans)

Solution (Python):
n,k=map(int,input().split())
if n==1:
  print(k)
else:
  sum=k
  for i in range(n-1):
    sum*=k-1
  print(sum)

Solution (Python):
N, K = map(int,input().split())
print(K * pow(K-1,N-1))

Solution (Python):
import sys









mod = int(1e9+7)
INF = 1<<29

def main():
    n,k = map(int,input().split())
    if n==1:
        print(k)
        return
    ans = k * ((k - 1) ** (n - 1))
    print(ans)
    return

if __name__=='__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):
def main():
    ball_num, color_num = map(int, input().split())
    print(color_num * pow(color_num - 1, ball_num - 1))


if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())


ans = K
for i in range(1,N):
    if K-1>0:
        ans *= K-1
print(ans)

Solution (Python):
N, K = map(int, input().split())
ans = K
for _ in range(N-1):
    ans *= K-1
print(ans)

Solution (Python):
N,K=map(int,input().split())
print(K*((K-1)**(N-1)))

Solution (Python):
n, k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):

import sys


def solve(N: int, K: int):
    print(K * (K - 1) ** (N - 1))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    solve(N, K)


if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
N, K = map(int, input().split())

print(K*((K-1)**(N-1)))

Solution (Python):
n,k = map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    print(K * ((K-1) ** (N-1)))

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, k = [int(e) for e in input().split()]
    ans = k * ((k - 1)**(n - 1))

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n, k = map(int, input().split())
ans = k * (k - 1)**(n - 1)
print(ans)

Solution (Python):
N,K = map(int,input().split())
print(K*((K-1)**(N-1)))

Solution (Python):

n,k=map(int,input().split())
print(k*pow(k-1,n-1))

Solution (Python):
N, K = map(int, input().split())

ans = K*(K-1)**(N-1)
print(ans)

Solution (Python):
N,K=map(int,input().split())
print(K*((K-1)**(N-1)))

Solution (Python):
n, k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())
print(k * (k - 1) ** (n - 1))

Solution (Python):

N,K = map(int, input().split())

c = 1
ans = K

for i in range(N-1):
    c = c*(K-1)

print(ans*c)

Solution (Python):
n, k = map(int, input().split())
ret = k
for _ in range(n - 1):
  ret *= (k - 1)
print(ret)

Solution (Python):


N,K = list(map(int,input().split()))

print(K*((K-1)**(N-1)))

Solution (Python):
K, N = map(int, input().split())
ans = N * ((N-1)**(K-1))
print(ans)

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
import math
k,m=list(map(int,input().split()))
res=m*pow(m-1,k-1)
print(res)

Solution (Python):
k,m = list(map(int, input().split()))
print(m*pow(m-1,k-1))

Solution (Python):
try:
    [n, k] = [int(x) for x in input().split()]
    print(k * (k - 1) ** (n - 1))
except:
    pass

Solution (Python):
n,m = list(map(int, input().split()))
print(m*pow(m-1,n-1))

Solution (Python):
N,K=input().split()

N=int(N)
K=int(K)

y=int(K*(K-1)**(N-1))
print(y)

Solution (Python):
a=list(map(int,input().split()))
if a[0]==1:
	print(a[1])
else:
	print(a[1]*((a[1]-1)**(a[0]-1)))

Solution (Python):
l=list(map(int,input().split()))
n,k=l
print(k*(k-1)**(n-1))

Solution (Python):

import sys
INF = float("inf")


def solve(N: int, K: int):
    print(K*((K-1)**(N-1)))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    solve(N, K)


if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):
n,k = map(int,input().split())
if n == 1:
  print(k)
else:
  print((k-1)**(n-1)*k)

Solution (Python):
N, K = map(int, input().split())
print(K * (K - 1)**(N - 1))

Solution (Python):
N, K = map(int, input().split())

ans = K
for i in range(N-1):
  ans *= (K - 1)
print(ans)

Solution (Python):



N,K = list(map(int, input().rstrip().split()))

ans = K * (K-1)**(N-1)
print(ans)

Solution (Python):
N, K = map(int, input().split())
print(K * ((K-1) ** (N-1)) )

Solution (Python):
N, K = map(int, input().split())
print(K * ((K-1) ** (N-1)) )

Solution (Python):
N,K = map(int, input().split())
print(K*(K - 1)**(N - 1))

Solution (Python):
N,K = map(int, input().split())

ans = 1

for i in range(N - 1):
    ans *= K - 1
    
print(ans * K)

Solution (Python):
balls, colors = map(int, input().split())

ans = 1
for i in range(balls):
    if i == 0 :
        ans *= colors
    else:
         ans *= colors - 1
         
print(ans)

Solution (Python):
n, k = map(int, input().split())
ans = 1

for i in range(n-1):
    ans *= k-1

print(ans * k)

Solution (Python):
N, K = map(int, input().split())
print(K * ((K - 1) ** (N - 1)))

Solution (Python):
N, K = map(int, input().split())
ans = K * (K - 1) ** (N - 1)
print(ans)

Solution (Python):
a , b = map(int,input().split())

ans = b * (b-1)**(a - 1)

print(ans)

Solution (Python):


n,k = map(int,input().split())

print(k * ((k - 1) **(n - 1)))

Solution (Python):
n,k=map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):
n,k = map(int,input().split())
ans = (k-1)**(n-1)
ans *= k
print(ans)

Solution (Python):
import itertools
N,K=map(int,input().split())
ans=1
flag=True

for i in range(N):
    if flag:
        ans*=K
        flag=False
    else:
        ans*=(K-1)

print(ans)

Solution (Python):


n,k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int,input().split())
print((k-1)**(n-1)*k)

Solution (Python):
n,k=map(int,input().split());print(k*(k-1)**~-n)

Solution (Python):
n,k = map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k = map(int,input().split())
count = k


if n == 1:
  print(k)

else:
  for i in range(1,n):
    count = count * (k-1)

  print(count)

Solution (Python):
n, k = map(int, input().split())
print(k * (k-1) ** (n-1))

Solution (Python):
n, k = map(int, input().split())

ans = k
for i in range(1, n):
    ans *= k-1

print(ans)

Solution (Python):
N, K = map(int, input().split())
print(K * (K - 1)**(N - 1))

Solution (Python):

N, K = map(int,input().split())
print(K*((K-1)**(N-1)))

Solution (Python):
N,K=map(int,input().split())

print(K*pow(K-1,N-1))

Solution (Python):
n ,k = map(int, input().split())

if n == 1:
  print(k)
else:
  print(k*(k-1)**(n-1))

Solution (Python):
n,k = map(int, input().split())

print(k * (k-1)**(n-1))

Solution (Python):
n, k = [int(x) for x in input().split()]
ans = 0
for i in range(n):
  if i == 0:
  	ans = k
  else:
    ans *= k-1
print(ans)

Solution (Python):
n,k = map(int,input().split())
ans = k*((k-1)**(n-1))
print(ans)

Solution (Python):
n, k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n, k = (int(x) for x in input().split())
print(k*((k-1)**(n-1))) if n != 1 else print(k)

Solution (Python):
n, k = map(int,input().split())

ans = k

for i in range(n-1):
    ans = ans * (k-1)

print(str(ans))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
a,b = map(int,input().split())
ans = b*pow(b-1,a-1)
print(ans)

Solution (Python):
n,k = map(int, input().split())
print(k* (k-1)**(n-1))

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, k = MAP()
print(k * (k - 1) ** (n-1))

Solution (Python):
a,b=map(int,input().split())
r=b
for x in range(a-1):
    r*=(b-1)
print(r)

Solution (Python):
n, k = map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):

N, K = map(int, input().split())

print(K * ((K-1)**(N-1)))

Solution (Python):
n, k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):

n, k = [int(a) for a in input().split()]


if n == 1:
    pattern = k
else:
    pattern = k*(k-1)**(n-1)
print(pattern)

Solution (Python):
n,k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k = map(int,input().split())

print(k * (k-1) ** (n-1))

Solution (Python):



n, k = [int(a) for a in input().split()]


if n == 1:
    pattern = k
else:
    pattern = k*(k-1)**(n-1)
print(pattern)

Solution (Python):
n, k = map(int, input().split())
print(k * (k - 1) ** (n - 1))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k= map(int, input().split())
ans=k*(k-1)**(n-1)
print(ans)

Solution (Python):




def main():
    N, K = map(int, input().split())
    print(K * (K - 1)**(N - 1))


if __name__ == "__main__":
    main()

Solution (Python):


n,k=map(int,input().split())


print(k*(k-1)**(n-1))

Solution (Python):
N,K=map(int,input().split())
print(K*((K-1)**(N-1)))

Solution (Python):
N, K = map(int, input().split())
print(K*(K-1)**(N-1))

Solution (Python):
N, K = map(int,input().split())
print(K * ((K-1) ** (N-1)))

Solution (Python):
n, k = map(int, input().split())
print(k * (k - 1) ** (n - 1))

Solution (Python):
N, K = map(int, input().split())
ans = K
for i in range(N-1):
    ans *= K - 1
print(ans)

Solution (Python):
N,K = map(int,input().split())
ans = K
for i in range(1,N):
	ans *= K - 1
print(ans)

Solution (Python):
n,k=map(int,input().split())

ans=k*(k-1)**(n-1)

print(ans)

Solution (Python):
def sum_of_pattern_paint_balls(sum_of_balls, paint_colors):

    paint_pattern = paint_colors
    for i in range(1, sum_of_balls):
        paint_pattern = paint_pattern * (paint_colors - 1)

    return paint_pattern


if __name__ == '__main__':
    sum_of_balls, paint_colors = map(int, input().split())
    print(sum_of_pattern_paint_balls(sum_of_balls, paint_colors))

Solution (Python):
n, k = map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
import sys
input = sys.stdin.readline
N,K = [int(i) for i in input().split()]
ans = 1
for i in range(N) :
    if i == 0 :
        ans *= K
    else :
        ans *= (K-1)
print(ans)

Solution (Python):
"""
author : halo2halo
date : 2, Feb, 2020
"""

import sys
import itertools

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a,b=(map(int, readline().split()))
print(b*(b-1)**(a-1))

Solution (Python):
n,k = map(int, input().split())

print(k*((k-1)**(n-1)))

Solution (Python):
n, k = map(int, input().split())
print(k*((k-1)**(n-1)))

Solution (Python):
def pin(type=int):
    return map(type,input().split())


N,K=pin()


print(K*((K-1)**(N-1)))

Solution (Python):
N, K = map(int, input().split())

ways = 1

ways *= K

ways *= pow(K - 1, N - 1)

print(ways)

Solution (Python):
n,k = map(int,input().split())

ans = k
for i in range(1,n):
    ans *= (k-1)
print(ans)

Solution (Python):
N, K = map(int, input().split())

ans = K
for i in range(N-1):
    ans *= K-1

print(ans)

Solution (Python):
N, K = map(int, input().split())

ans = K * (K - 1) ** (N - 1)

print(ans)

Solution (Python):
n,k=map(int,input().split())
def pt(n,k):
  if n==1:
    return k
  else:
    return pt(n-1,k)*(k-1)
print(k*((k-1)**(n-1)))

Solution (Python):
n,k = list(map(int,input().split()))
print(k*((k-1)**(n-1)))

Solution (Python):
N, K = [int(i) for i in input().split()]

ans = K
for _ in range(1, N):
    ans *= (K - 1)
print(ans)

Solution (Python):
n,k=map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):


def main():
    N, K = map(int, input().split())
    res = K * (K -1)**(N-1)

    print(res)

if __name__ == "__main__":
    main()

Solution (Python):
N,K = map(int, input().split())

ans = K
for i in range(2,N+1):
  ans *= (K - 1)
  
print(ans)

Solution (Python):
n, k = [int(i) for i in input().split()]
print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())
result = 1

result *= k
for i in range(n - 1):
    result *= (k - 1)

print(result)

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

Solution (Python):
N, k = map(int, input().split()) 
print(k*pow(k-1,N-1))

Solution (Python):
import sys


n, k = map(int, input().split())


color = k * ((k - 1) ** (n - 1))

print(color)

Solution (Python):
arr = input().split()
n = int(arr[0])
k = int(arr[1])

count = 1
for i in range(n):
    if i == 0:
        count *= k
    else:
        count *= (k-1)

print(count)

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n ,k = map(int, input().split())
ans = k
for i in range(n-1):
    ans *= k-1
    
print(ans)

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int,input().split())
ans=k
if n!=1:
    for i in range(n-1):
        ans=ans*(k-1)
    print(ans)
else:
    print(ans)

Solution (Python):
n,k=map(int,input().split())
ans=1
for i in range(n):
    ans*=k
    if(i==0):
        k-=1
print(ans)

Solution (Python):
N, K = map(int, input().split())

print(K*pow((K-1), (N-1)))

Solution (Python):
if __name__ == '__main__':
	n, k = map(int, input().split())
	ans = 1
	for i in range(0,n):
		if i == 0:
			ans = ans * k
		else:
			ans = ans * (k - 1)
	print(ans)

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
N, K = map(int,input().split())
ans = K
for k in range(N-1):
    ans *= K-1
print(ans)

Solution (Python):

def main():
    n, k = map(int, input().split())
    ans = 1
    for i in range(n):
        if i == 0:
            ans *= k
        else:
            ans *= (k-1)
    print(ans)

main()

Solution (Python):
N, K = map(int, input().split())

print(K * (K-1) ** (N - 1))

Solution (Python):
a = input().split()
n = int(a[0])
k = int(a[1])

total = 0

for i in range(n):
    if i == 0:
        total = k
    else:
        total = total * (k - 1)

print(total)

Solution (Python):
import itertools
N,K=map(int,input().split())
print(K*(K-1)**(N-1))

Solution (Python):
N , K = map(int,input().split())
r = ((K - 1) ** (N - 1)) * K
print(int(r))

Solution (Python):
N, K = map(int, input().split())
print(K*((K-1)**(N-1)))

Solution (Python):
n,k = map(int,input().split())


print(k*((k-1)**(n-1)))

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,k=INTM()
    print(((k-1)**(n-1))*k)
if __name__ == '__main__':
    do()

Solution (Python):
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int, input().split())
print(k*((k-1)**(n-1)))

Solution (Python):
n,k=map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):


N,K=map(int,input().split())

ans=K
for i in range(N-1):
    ans*=(K-1)

print(ans)

Solution (Python):
N, K = map(int, input().split())

print(K * ((K - 1) ** (N - 1)))

Solution (Python):
N,K=map(int,input().split())

A=K*((K-1)**(N-1))

print(A)

Solution (Python):
n,k = map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())

print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())
 
ans = k * (k-1) ** (n-1)
 
print(ans)

Solution (Python):
n, k = map(int, input().split())

ans = k * (k-1) ** (n-1)

print(ans)

Solution (Python):

def PaintingBalls():
    N, K = map(int, input().split())
    ans = K * ((K - 1) ** (N - 1))
    print(ans)


def main():
    
    PaintingBalls()


if __name__ == "__main__":
    main()

Solution (Python):
N,K = map(int,input().split())
ans = 0

for n in range(N):
  if n == 0:
    ans += K
    continue

  ans *= (K - 1)

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
N, K = [int(x) for x in input().split()]
ans = K * (K - 1) ** (N - 1)
print(ans)

Solution (Python):
n, r = map(int, input().split())
ans = r
for _ in range(n-1):
    ans *= r-1
print(ans)

Solution (Python):
NK = input().split()
N, K = int(NK[0]), int(NK[1])
print(K*(K-1)**(N-1))

Solution (Python):
n,k=map(int,input().split())
ans=1
for i in range(n):
  if i==0:
    ans*=k
  else:
    ans*=k-1
print(ans)

Solution (Python):
N,K = [int(i) for i in input().split()]

print(K * (K-1) ** (N-1))

Solution (Python):
n,k=map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):
n, k = map(int,input().split())

print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())

print(k*(k-1)**(n-1))

Solution (Python):
N, K = map(int, input().split())
print(K * ((K - 1) ** (N - 1)))

Solution (Python):
N, K = map(int, input().split())
result = K * ((K - 1) ** (N - 1))
print(result)

Solution (Python):
N,K = [int(i) for i in input().split()]
answer = K
for i in range(N-1):
  answer *= K-1
print(answer)

Solution (Python):
n,k = map(int,input().split())
print(k*((k-1)**(n-1)))

Solution (Python):



n,k = map(int, input().split())

p = (k-1) ** n + (k-1) ** (n-1)

print(p)

Solution (Python):
n,k = map(int,input().split())

print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())
ans = k
for i in range(n-1):
    ans *= (k-1)
print(ans)

Solution (Python):
n, k = map(int, input().split())

if n ==1:
  print(k)
else:
  print(k * ((k - 1) ** (n - 1)))

Solution (Python):
N, K = map(int,input().split())

ans = 1

for i in range(N):
    if i == 0:
        ans *= K
    else:
        ans *= K-1

print(ans)

Solution (Python):
N, K = map(int, input().split())

n = K
for i in range(N - 1):
    n *= (K - 1)

print(n)

Solution (Python):
n,k=map(int,input().split())
print((k*(k-1)**(n-1)))

Solution (Python):
n, k = (int(i) for i in input().split())  
first = n*k
if n==1:
    print(first)
else:
    secound =(k-1)**(n-1)
    goukei=k*secound
    print(goukei)

Solution (Python):
n, k= map(int,input().split())
print(k * (k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())
if n == 1:
  print(k)
else:
  print(k*((k-1)**(n-1)))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int,input().split())
ans=k
for i in range(1,n):
    ans*=k-1
print(ans)

Solution (Python):
N,K=map(int,input().split())
print(K*((K-1)**(N-1)))

Solution (Python):
N,K = map(int, input().split())

print(K*(K-1)**(N-1))

Solution (Python):
nk=list(map(float,input().split()))

ans=nk[1]*((nk[1]-1)**(nk[0]-1))
print(int(ans))

Solution (Python):


import sys
input = sys.stdin.readline

N,K = map(int,input().split())

res = K * (K-1)**(N-1)

print(res)

Solution (Python):
n, k = map(int, input().split())

count = k
for i in range(n-1):
   count *= k - 1

print(count)

Solution (Python):
N, K = map(int, input().split())
if N == 1:
    print(K)
else:
    print(K * (K-1) ** (N-1))

Solution (Python):
n, k = map(int, input().split())
print((k-1)**(n-1)*k)

Solution (Python):
n,k=map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=list(map(int, input().split()))
ans = 0

if n ==1:
  print(str(k))
else:
  ans= k*(k-1)**(n-1)
  print(ans)

Solution (Python):
n, k = map(int, input().split())

print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):

import sys


def main(argv=sys.argv):

    ball_count, color_count = map(int, input().split(' '))

    print(color_count * (color_count - 1) ** (ball_count - 1))

    return 0


if __name__ == '__main__':
    sys.exit(main())

Solution (Python):
n,k = map(int,input().split())

ans = 1

for i in range(n):
   if i == 0:
      ans *= k
   else:
      ans *= k-1

print(ans)

Solution (Python):
n,k=map(int, input().split())
ans=k
for i in range(n-1):
    ans*=k-1
print(ans)

Solution (Python):
N, K = map(int, input().split())
print(K*((K-1)**(N-1)))

Solution (Python):
n,k = map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
N, K = map(int, input().split())

ans = K * (K - 1)**(N-1)
print(ans)

Solution (Python):
n, k = map(int, input().split())

ans = k

for i in range(n-1):
    ans *= k-1

print(ans)

Solution (Python):
n, k = map(int, input().split())

print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())
ans = k * (k-1)**(n-1)
print(ans)

Solution (Python):



import sys
import numpy as np
from collections import deque as deq

N, K = map(int, input().split())

print(K * ((K - 1)**(N - 1)))

Solution (Python):

import sys

def main(argv=sys.argv):
  N, K = map(int, input().split())
  print(K * ((K - 1) ** (N - 1)))
  
  
  return 0

if __name__ == '__main__':
  sys.exit(main())

Solution (Python):

import sys


def main(argv=sys.argv):
  N, K = map(int, input().split())
  print(K * ((K - 1) ** (N - 1)))
  
  return 0
 
if __name__ == '__main__':
  sys.exit(main())

Solution (Python):
n, k = map(int, input().split())
print(k * (k - 1)**(n - 1))

Solution (Python):
n,k = map(int,input().split())
s = k
while(n>1):
    s *= (k-1)
    n-=1
print(s)

Solution (Python):
N, K = list(map(int, input().split()))
print(K * (K-1)**(N-1))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n,k = map(int, input().split())
print(k * (k-1) ** (n-1))

Solution (Python):
n,k = map(int, input().split())

ans = k
for i in range(1, n):
    ans *= k-1

print(ans)

Solution (Python):
N, K = map( int, input().split() )
sol = K 
for i in range(N-1) :
    sol = sol * (K-1)
print(sol)

Solution (Python):
n,k = map(int,input().split())
 
print(k * (k-1)**(n-1))

Solution (Python):
import sys
def resolve():
        input = sys.stdin.readline
        N,K=map(int,input().rstrip().split())

        print(K*pow(K-1,N-1))    




import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2 2"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """1 10"""
        output = """10"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """10 8"""
        output = """322828856"""
        self.assertIO(input, output)

if __name__ == "__main__":
    
    resolve()

Solution (Python):

n,k = map(int,input().split())

print(k * (k-1)**(n-1))

Solution (Python):
a,b = list(map(int,input().split()))
ans = 1
ans *= b
for i in range(1,a):
  ans *= b-1
print(ans)

Solution (Python):
m, k = map(int, input().split())

ans = k
for i in range(1, m):
    ans *= (k - 1)
print(ans)

Solution (Python):
n, k = map(int, input().split())
print( k*(k-1)**(n-1) )

Solution (Python):
n,k = [int(i) for i in input().split()]

print(k * ((k-1) ** (n-1)))

Solution (Python):
N, K = map(int, input().split())

print(K * (K-1)**(N-1))

Solution (Python):
N,K=map(int,input().split())
print(K*pow(K-1,N-1))

Solution (Python):
N, K = map(int, input().split())
print(K * (K - 1)**(N-1))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
a, b = map(int, input().split())
ans = 1
for i in range(a):
    if i == 0:
        ans *= b
    else:
        ans *= (b-1)

print(ans)

Solution (Python):
a,b=map(int,input().split())
n=b*(b-1)**(a-1)
print(n)

Solution (Python):
n, k = map(int, input().split())
if n == 1:
    print(k)
else:
    print((k-1)**(n-1)* k)

Solution (Python):
N, K = list(map(int, input().split()))
n = N
print(K*((K-1)**(N-1)))

Solution (Python):
N, K = (int(i) for i in input().split())
print(K*(K-1)**(N-1))

Solution (Python):
N, K = map(int, input().split())
print(K * (K - 1) ** (N - 1))

Solution (Python):
import sys

n, k = map(int, sys.stdin.readline().split())

def main():
    ans = k * (k - 1)**(n-1)
    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
N,K = map(int, input().split())
print(K * (K-1)**(N-1))

Solution (Python):
N, K = map(int, input().split())
print(K * pow(K - 1, N - 1))

Solution (Python):
N,K = map(int,input().split())
print(K*(K-1)**(N-1))

Solution (Python):
N, K = map(int, input().split())

ans = K
for i in range(N-1):
  ans *= (K-1)
  
print(ans)

Solution (Python):
n, k = map(int, input().split())

print(k * ((k - 1)**(n - 1)))

Solution (Python):
n,k = map(int,input().split())
ans = k
for i in range(n-1):
  ans *= (k-1)
print(ans)

Solution (Python):
N, K = map(int,input().split())


ans = K * ((K - 1)**(N - 1))
print(str(ans))

Solution (Python):
a,b=map(int,input().split())
if a==1:
  print(b)
else:
  print(b*(b-1)**(a-1))

Solution (Python):
N, K = map(int, input().split())

result = K
for i in range(1, N):
    result *= (K-1)
    
print(result)

Solution (Python):
N, K = map(int, input().split())
2, 1
10
8, 7, 7, 7, 7,

result = K
for i in range(1, N):
    result *= (K-1)
    
print(result)

Solution (Python):
N, K = list(map(int, input().split()))
print(K*(K-1)**(N-1))

Solution (Python):
N,K=map(int,input().split())

if N>1:
  res = K*(K-1)**(N-1)
else:
  res = K

print(res)

Solution (Python):
n,k=map(int,input().split())
count=k
for i in range(n-1):
    count*=k-1
print(count)

Solution (Python):
N, K = map(int,input().split())
print(K*((K-1)**(N-1)))

Solution (Python):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
n, k = map(int, input().split())
ans = k
for i in range(n-1):
    ans *= k-1  
print(ans)

Solution (Python):
NK=list(map(int,input().split()))
N=NK[0]
K=NK[1]
print(K*((K-1)**(N-1)))

Solution (Python):
N,K = map(int, input().split())

ans = K
for i in range(1,N):
    ans *= (K-1)

print(ans)

Solution (Python):
n, k = (int(x) for x in input().split(' '))
print(k*(k-1)**(n-1))

Solution (Python):
n,k = [int(i) for i in input().split()]

print(k * (k - 1) ** (n - 1))

Solution (Python):
n,k= map(int, input().split())

ans = k * pow(k-1, n-1)
print("{}".format(ans))

Solution (Python):
n,k = map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):
N, K = map(int, input().split())

print(K * (K - 1) ** (N - 1))

Solution (Python):
N, K = map(int, input().split())

ans = K * (K - 1) ** (N - 1)

print(ans)

Solution (Python):
from sys import stdin

n,k = [int(x) for x in stdin.readline().rstrip().split()]

point = 1

for i in range(1,n):
    point *= k-1

print(point*k)

Solution (Python):
n, k =map(int, input().split())
print(k*(k-1)**(n-1))

Solution (Python):
N,K=map(int,input().split())
print(K*(K-1)**(N-1))

Solution (Python):
N,K = map(int, input().split())
ans=1
for i in range(1,N):
    ans *=(K-1)
ans*=K
    
print(ans)

Solution (Python):
n, k = map(int, input().split())

print(k * (k - 1) ** (n - 1))

Solution (Python):
n, k = map(int, input().split())

print(k*(k-1)**(n-1))

Solution (Python):
N,K = map(int, input().split())
ans = 0

ans = K * (K-1)**(N-1)
print(ans)

Solution (Python):
n, k = [int(i) for i in input().split()]
print(k * (k - 1) ** (n - 1))

Solution (Python):
ball, color = map(int, input().split())

first = color * 1
second = 1
if ball != 1: second = (color - 1) ** (ball-1)

print(first * second)

Solution (Python):
N, K = map(int, input().split())
p=pow(K-1,N-1)*K
print(p)

Solution (Python):
N, K = map(int,input().split())
if N == 1:
  print(K)
else:
  print(K * (K - 1)**(N - 1))

Solution (Python):
n,k = map(int,input().split())
print(k*(k-1)**(n-1))

Solution (Python):

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