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 int MOD = 1000000007;
list<long long int> Prime(int M) {
  list<long long int> P;
  P.push_back(2);
  P.push_back(3);
  for (int i = 5; i <= M; i += 6) {
    bool flag = true;
    for (auto j : P) {
      if (i % j == 0) {
        flag = false;
        break;
      }
    }
    if (flag) P.push_back(i);
    flag = true;
    for (auto j : P) {
      if ((i + 2) % j == 0) {
        flag = false;
        break;
      }
    }
    if (flag) P.push_back(i + 2);
  }
  return P;
}
long long int N, M, K, Q, W, H;
long long int ans;
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> K;
  cout << K * pow(K - 1, N - 1) << endl;
  return 0;
}
