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;
long long int power(long long int n, long long int k);
long long int inv(long long int n);
long long int genfact(long long int n, long long int k);
long long int fact(long long int n);
long long int nck(long long int n, long long int k);
int main(void) {
  int n, k;
  cin >> n >> k;
  int ret = n;
  for (int i = 0; i < k - 1; i++) {
    ret *= n - 1;
  }
  cout << ret << endl;
  return 0;
}
long long int power(long long int n, long long int k) {
  long long int res = 1;
  while (k > 0) {
    if (k & 1) res = res * n % 1000000007;
    n = n * n % 1000000007;
    k >>= 1;
  }
  return res;
}
long long int genfact(long long int n, long long int k) {
  long long int res = 1;
  while (k >= 0) {
    res = (res * (n - k)) % 1000000007;
    k--;
  }
  return res;
}
long long int inv(long long int n) { return power(n, 1000000007 - 2); }
long long int fact(long long int n) { return genfact(n, n - 1); }
long long int nck(long long int n, long long int k) {
  if (k == 0) return 1;
  if (n <= 0) return 0;
  return ((genfact(n, k) % 1000000007) * inv(fact(k))) % 1000000007;
}
