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;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const ll MOD9 = 998244353;
const int inf = 1e9;
const ll INF = 4e18;
const ll dy[4] = {1, 0, -1, 0};
const ll dx[4] = {0, -1, 0, 1};
int main() {
  ll N;
  ll K;
  cin >> N >> K;
  if (N == 1) {
    cout << K << endl;
  }
  if (N == K) {
    ll fac = 1;
    for (ll i = (1); i < (K + 1); i++) {
      fac *= i;
    }
    cout << fac << endl;
  } else {
    ll x = K - 1;
    ll ex = K - 1;
    for (ll i = (1); i < (N - 1); i++) {
      ex = ex * (K - 1);
    }
    cout << ex * K << endl;
  }
}
