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 pint = pair<int, int>;
long long mod = 1000000007, mod2 = 998244353;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
bool is_prime[1000010];
vector<pair<int, int>> fac(int n) {
  vector<pair<int, int>> ans;
  for (int i = 2; i * i <= n; ++i) {
    if (n % i != 0) continue;
    int cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    ans.push_back({i, cnt});
  }
  if (n != 1) ans.push_back({n, 1});
  return ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  cout << k * pow(k - 1, n - 1) << endl;
  return 0;
}
