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;
std::vector<unsigned long long> genprimevec(const unsigned long long N);
long long extgcd(long long a, long long b, long long &x, long long &y);
long long nCr(long long n, long long r);
void stat();
constexpr long long mod = 1000000000 + 7;
unsigned long long fn(int k) {
  if (k == 1) {
    return 1;
  }
  return k * fn(k - 1);
}
int main() {
  stat();
  int n, k;
  cin >> n >> k;
  cout << k * (pow(k - 1, n - 1)) << endl;
  return 0;
}
long long extgcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  long long d = extgcd(b, a % b, y, x);
  y -= a / b * x;
  return d;
}
std::vector<unsigned long long> genprimevec(const unsigned long long N) {
  std::vector<bool> is_prime(N + 1);
  for (unsigned long long i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  std::vector<unsigned long long> P;
  for (unsigned long long i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (unsigned long long j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}
void stat() {}
long long nCr(long long n, long long r) {
  long long num = 1;
  for (long long i = 1; i <= r; i++) {
    num = num * (n - i + 1) / i;
  }
  return num;
}
