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;
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();
void abc046_b(vector<vector<int>> v) {
  double n = double(v[0][0]);
  double k = double(v[1][0]);
  double val = pow(double(k - 1), double(n - 1));
  val *= k;
  cout << val << endl;
}
int main() {
  vector<vector<int>> vec_arr_result;
  vec_arr_result = getinputdata2();
  abc046_b(vec_arr_result);
  return 0;
}
vector<vector<double>> getinputdata3() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<double>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<double> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(atof(ret.c_str()));
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
vector<vector<int>> getinputdata2() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<int>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<int> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(atoi(ret.c_str()));
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
vector<vector<string>> getinputdata() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<string>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<string> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(ret);
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
