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;
const long long M = 1e9 + 7;
const long long inf = 1e18;
const int si = 1e5 + 9;
const int N = 1e5 + 5;
int n, k;
long long mem[1001][1001];
long long dp(int i, int p) {
  if (i == n) return 1;
  long long &r = mem[i][p];
  if (r != -1) return r;
  r = 0;
  for (int l = 0; l < int(k); l++) {
    if (l != p) r += dp(i + 1, l);
  }
  return r;
}
int main() {
  cin >> n >> k;
  long long ans = 0;
  memset(mem, -1, sizeof(mem));
  ans = dp(0, k + 1);
  cout << ans;
  return 0;
  ;
}
