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 int INF = 1e9, MOD = 1e9 + 7,
          around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
const long long LINF = 1e18;
const long double PI = abs(acos(-1));
int n, m, k, a, b;
int li[100010] = {};
long long dp[2][110];
long long s[2][110];
int main() {
  cin >> n >> k;
  for (int i = (0); i < (2); i++)
    for (int j = (0); j < (k + 1); j++) dp[i][j] = s[i][j] = 0;
  if (li[0])
    dp[0][li[0] - 1] = 1;
  else
    for (int i = (0); i < (k); i++) dp[0][i] = 1;
  for (int i = (0); i < (k); i++) s[0][i + 1] = s[0][i] + dp[0][i];
  for (int q = (1); q < (n); q++) {
    int tar = q % 2, cur = 1 - tar;
    if (li[q]) {
      for (int j = (0); j < (k); j++) {
        if (j == li[q] - 1)
          dp[tar][j] = (s[cur][k] - dp[cur][j] + MOD) % MOD;
        else
          dp[tar][j] = 0;
      }
    } else {
      for (int j = (0); j < (k); j++)
        dp[tar][j] = (s[cur][k] - dp[cur][j] + MOD) % MOD;
    }
    for (int j = (0); j < (k); j++)
      s[tar][j + 1] = (s[tar][j] + dp[tar][j] + MOD) % MOD;
  }
  cout << s[1 - n % 2][k] << endl;
  return 0;
}
