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;
template <class T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
string converter(T n) {
  stringstream x;
  x << n;
  return x.str();
}
string itos(int a) {
  string s = to_string(a);
  return s;
}
template <class T>
T mod_pow(T x, T n) {
  T res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
    n >>= 1;
  }
  return res;
}
std::vector<std::string> split(const std::string &str, char sep) {
  std::vector<std::string> v;
  std::stringstream ss(str);
  std::string buffer;
  while (std::getline(ss, buffer, sep)) {
    v.push_back(buffer);
  }
  return v;
}
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
bool mysort(pair<int, int> a, pair<int, int> b) { return a.second > b.second; }
int main(void) {
  int n, k;
  cin >> n >> k;
  ;
  long long ans = 1;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      ans *= k;
    } else {
      ans += (k - 1);
    }
  }
  cout << ans << '\n';
  return 0;
}
