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.

Examples

Input

2 2


Output

2


Input

1 10


Output

10
#include <bits/stdc++.h>
using namespace std;
unsigned long long a[1005];
unsigned long long p(unsigned long long n, unsigned long long m) {
  if (n == m) return 1;
  if (m == 0) return 1;
  return n * p(n - 1, m);
}
int main() {
  unsigned long long n, k, s = 0, i;
  scanf("%lld%lld", &n, &k);
  for (i = n; i >= 2; i--) {
    s += p(k, k - i) * p(i, 1);
  }
  if (n == 1) s += p(k, k - i) * p(i, 1);
  printf("%lld\n", s);
  return 0;
}
