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):
A=list(map(int,input().split()))
ans=A[1]
for i in range(0,A[0]-1):
    ans=ans*(A[1]-1)
print(ans)

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

Solution (Python):
icase=0
if icase==0:
    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 = list(map(int, input().split()))
 
ans = b
for i in range(a - 1):
  ans *= b - 1
 
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())
print(K*((K-1)**(N-1)))

Solution (Python):
if __name__ == "__main__":
  n,k = map(int,input().split())
  ans = int(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):


nim, mike = map(int, input().split())
print(mike * (mike - 1) ** (nim - 1))

Solution (Python):
n,k = [int(x) for x in 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())

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()]

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

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())
C = K * ((K-1) ** (N-1))
print(C)

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 = list(map(int, input().split()))

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

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

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

print(ans)

Solution (Python):

import sys
input = sys.stdin.readline









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 = 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())
print(k*(k-1)**(n-1))

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

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

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

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

Solution (Python):
import math
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:
  result = K
else:
  result = K * (K-1) ** (N-1)

print(result)

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())

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

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)

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

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

Solution (Python):
x,y = map(int,input().split())

count = y

for i in range(x-1):
    count *= y-1
print(count)

Solution (Python):
N = list(map(int,input().split()))
ans = N[1]
for i in range(N[0]-1):
    ans *= N[1]-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())

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())

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

print(output)

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

print(cnt)

Solution (Python):
url = "https://atcoder.jp/contests/abc046/tasks/abc046_b"

def main():

    n, m = list(map(int, input().split()))
    count = (m - 1) ** (n - 1) * m
    print(count)


if __name__ == '__main__':
    main()

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(i) for i in 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:
    print(k)
    exit()
for i in range(n-1):
    ans*=k-1
print(ans)

Solution (Python):
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Solution (Python):


d, n = map(int,input().split())
ans = n*(n-1)**(d-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())
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) * K
print(ans)

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


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

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):
n,k = map(int,input().split())
ans = k
for _ in range(n-1):
  ans *= k-1
  
print(ans)

Solution (Python):
import sys
import math
MAX_INT = int(10e11)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()
print(K*(K-1)**(N-1))

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

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, k = na()

if n == 1:
    print(k)
    exit(0)

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

print(ans)

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

Solution (Python):
N, K = map(int, input().split())
ans = K
for i in range(N - 1):
    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())
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())
print(k*(k-1)**(n-1))

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

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

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

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

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


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())
if n==1:
    print(k)
else:
    print((k-1)**(n-1)*k)

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*pow(k-1,n-1))

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

if n==1:
    print(k)

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

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

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

print(result)

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):
from itertools import permutations
import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    n,k=MI()
    ans=k*pow(k-1,n-1)
    print(ans)

main()

Solution (Python):

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

Solution (Python):
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N, K = map(int, input().split())
    
    res = K
    for i in range(N-1):
        res *= K - 1
    
    print(res)
    

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):
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
print(K * pow(K - 1, N - 1))

Solution (Python):
def main():
    N, K = (int(i) for i in 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())
ans = k * (k-1)**(n-1)
print(ans)

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

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

print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
res = 1
for i in range(n):
    if i == 0:
        res *= k
    else:
        res *= k-1
print(res)

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

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


if __name__ == '__main__':
    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())

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 * (k-1)**(n-1)
print(ans)

Solution (Python):




"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""



import math


def main():
  n,k = map(int,input().split())
  print(k * (k-1) ** (n-1))
    
if __name__ == '__main__':
  main()

Solution (Python):
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)


n, k = map(int, input().split())
ans = k
if n >= 2:
    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):
n, k = map(int, input().split())
if n == 1:
    ans = k
    print(ans)
else:
    ans = k*(k-1)**(n-1)
    print(ans)

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

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

ans = 1

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

print(ans)

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

print(b * (b-1)  ** (a - 1))

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

Solution (Python):
import sys

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

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

print("{}".format(pattern))

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

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 = [int(i) for i in input().split()]
print(K*(K-1)**(N-1))

Solution (Python):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    b, c = map(int, input().split())

    print(c * ((c-1) **(b-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):
x = list(map(int,input().split()))
print(x[1]*((x[1]-1)**(x[0]-1)))

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
res = 1
for i in range(n):
    if i == 0:
        res *= k
    else:
        res *= (k-1)
print(res)

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

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

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    total = K
    for i in range(N-1): total *= (K - 1)
    print(total)
    return 0

if __name__ == "__main__":
    solve()

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*(k-1)**(n-1)
print(ans)

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

Solution (Python):
def resolve():

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


resolve()

Solution (Python):

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

ans = k * pow(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())
ans=K*((K-1)**(N-1))
print(ans)

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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*pow(k-1,n-1))

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

Solution (Python):
def solve():
    n,k =map(int,input().split())
    print(((k-1)**(n-1))*k)
if __name__ == "__main__":
    solve()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
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 STR(): return input()
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 = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n, k = MAP()
ans = k * (k - 1) ** (n - 1)
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())
print(K * pow(K - 1, N - 1))

Solution (Python):
n, k = map(int,input().split())
ans = 1
if n == 1:
	print(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):
N, K = map(int, input().split())

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

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

print(c)

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())
print(b*((b-1)**(a-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 = list(map(int, input().split()))
k = K
if N >= 2:
    for i in range(N - 1):
        k = k *(K - 1)
print(k)

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

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

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

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

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

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

Solution (Python):
N,M  = map(int,input().split(" "))
Ans = M
if N>1:
    for _ in range(N-1):
        Ans*=M-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()))
print(K*(K-1)**(N-1))

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

Solution (Python):
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

n,k = inpl()
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-1)**(N-1)*K)

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

Solution (Python):
n, k = [int(x) for x in input().split()]
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 = 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 = [int(i) for i in input().split()]

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

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

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 = 1 * k * (k-1)**(n-1)
print(ans)

Solution (Python):
import math

N, K = list(map(int, input().split()))
print(int(K * math.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):
N, K = map(int, input().split())
print(K * (K - 1) ** (N - 1))

Solution (Python):

N,K = map(int,input().split())
if N >=2:
    c = K*(K-1)**(N-1)
elif N ==1 :
    c = K
print(c)

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 = 1
for i in range(n):
    if i == 0:
        ans *= k
        continue
    ans *= (k - 1)
print(ans)

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

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

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

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

x=k

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

print(x)

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())
v = 0
for i in range(n):
	if i == 0:
		v = k
	else:
		v = v*(k-1)
print(v)

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

n = n-1

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

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

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

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,K=MI()
    print(K*pow(K-1,N-1))

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,c = list(map(int,input().split()))
print(c*((c-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 = 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*(k-1)**(n-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())

ans = k * (k-1)**(n-1)
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
for i in range(1,n):
    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()))
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())
cnt = K*(K-1)**(N-1)
print(cnt)

Solution (Python):








def resolve():
    N,K=map(int,input().split())
    val=K
    for i in range(2,N+1):
        val*=(K-1)
    print(val)

resolve()

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())
print(k*(k-1)**(n-1))

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

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

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

Solution (Python):
if __name__ == "__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)

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

if n == 0:
  print(0)
  exit()

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

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

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

Solution (Python):

s = input().split()
t = [int(p) for p in s]


N = t[0]
K = t[1]

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

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-1)**(n-1)
print(ans*k)

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

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

if a == 1:
	print(b)
else:
	ans = 1
	for i in range(a-1):
		ans *= (b-1)
	print(ans * b)

Solution (Python):
n,k=map(int,input().split())
ans=k*pow(k-1,n-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())

ans = 0
if N == 1:
    ans = K
else:
    ans = K * (K - 1) ** (N - 1)

print(ans)

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

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 STR(): return input()
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 = sys.maxsize
mod = 10 ** 9 + 7

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

Solution (Python):
a,b=map(int,input().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())
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())

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

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

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

print(ans)

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


if __name__ == '__main__':
    main()

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):
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    ans = K
    for i in range(1, N): ans *= (K - 1)
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

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

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

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

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

print(getCombinationCount(N, K))

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

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

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

Solution (Python):
n,k=input().split()
N=int(n)-1
K=int(k)-1
ans=K+1
for i in range(N):
    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())
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(int(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())
ret = K
for i in range(2,N+1):
  ret *= K-1
print(ret)

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 resolve():
    n, k = map(int, input().split())
    ans = k * ((k-1) ** (n-1))
    print(ans)

if __name__ == '__main__':
    resolve()

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

if __name__ == '__main__':
    resolve()

Solution (Python):
n,k = map(int,input().split())
print(k if n==1 else 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):
line = input().split(' ')
print(int(line[1])*((int(line[1])-1)**(int(line[0])-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))