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>
struct S002 {
  int n;
  S002& operator>(long& x) {
    n = x;
    return *this;
  }
  S002& operator>(long&& x) {
    n = x;
    return *this;
  }
  S002& operator>=(long& x) {
    if (scanf("%ld", &x) <= 0) exit(0);
    return *this;
  }
  S002& operator>=(double& x) {
    if (scanf("%lf", &x) <= 0) exit(0);
    return *this;
  }
  S002& operator>=(std::string& s) {
    if (not(std::cin >> s)) exit(0);
    return *this;
  }
  template <typename a>
  S002& operator>=(std::vector<a>& v) {
    v.resize(n);
    for (long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template <typename a, std::size_t s>
  S002& operator>=(std::array<a, s>& x) {
    for (long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};
template <typename a>
struct S009 {
  a pow(a x, long n) {
    if (n == 0) return a(1);
    a t = pow(x, n / 2);
    return t * t * (x % 2 ? x : a(1));
  }
};
struct Solver {
  long n, k;
  Solver() {
    S002 r;
    r >= n >= k;
  }
  void solve() {
    S009<long> s;
    long res = k * s.pow(k - 1, n - 1);
    printf("%ld\n", res);
  }
};
int main() {
  for (;;) std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}
