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>
#pragma GCC optimize("O3")
using namespace std;
using namespace std::placeholders;
using ll = long long;
constexpr ll INF = 999999999LL;
constexpr ll MOD = 1e9 + 7;
template <typename T>
T high() {
  return numeric_limits<T>::max();
}
template <typename T>
T high(T) {
  return numeric_limits<T>::max();
}
template <typename T>
T low() {
  return numeric_limits<T>::lowest();
}
template <typename T>
T low(T) {
  return numeric_limits<T>::lowest();
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class C, class F>
inline C mapped(const C& c, F f) {
  C r;
  r.reserve(c.size());
  transform((c).begin(), (c).end(), back_inserter(r), f);
  return r;
}
template <class C, class F>
inline C filtered(const C& c, F f) {
  C r;
  copy_if((c).begin(), (c).end(), back_inserter(r), f);
  return r;
}
template <class C, class I, class F>
inline typename C::value_type foldl(const C& c, I i, F f) {
  return accumulate((c).begin(), (c).end(),
                    static_cast<typename C::value_type>(i), f);
}
template <class T>
ostream& operator<<(ostream& s, vector<T> v) {
  for (ll i = 0, i_len = (v.size()); i < i_len; i++) {
    if (i != 0) {
      s << " ";
    }
    s << v[i];
  }
  return s;
}
template <class T, class U>
ostream& operator<<(ostream& s, pair<T, U> p) {
  return s << p.first << " " << p.second;
}
ll dfs(ll PREV, ll i, ll N, ll K) {
  if (i == N) return 1;
  ll result = 0;
  for (ll k = 0, k_len = (K); k < k_len; k++) {
    if (k != PREV) {
      result += dfs(k, i + 1, N, K);
    }
  }
  return result;
}
int main() {
  ll N, K;
  cin >> N >> K;
  cout << dfs(-1, 0, N, K) << endl;
  return 0;
}
