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;
const long long MAX_10p5 = 100010;
const long long MAX_10p9 = 1000000010;
const long long MAX_10p18 = 1000000000000000010;
const long long MOD = 1000000007;
const long long m4x[4] = {1, 0, -1, 0};
const long long m4y[4] = {0, 1, 0, -1};
const long long m8x[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long m8y[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long m9x[9] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long m9y[9] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
struct edge {
  long long from, to, cost;
  bool operator<(const edge& right) const { return cost < right.cost; }
};
struct point {
  long long x, y;
  bool operator<(const point& right) const {
    return x == right.x ? y < right.y : x < right.x;
  }
};
long long powll(long long a, long long x) {
  long long ret = a;
  for (long long i = (long long)(1); i < (long long)(x); i++) {
    ret *= a;
  }
  return ret;
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long ans = k * powll(k - 1, n - 1);
  cout << ans << endl;
  return 0;
}
