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;
struct SegmentTree {
 private:
  int n;
  vector<int> node;

 public:
  SegmentTree(vector<int> v) {
    int z = v.size();
    n = 1;
    while (n < z) n *= 2;
    node.resize(2 * n - 1, 0);
    for (int i = 0; i < z; i++) node[(n - 1) + i] = v[i];
    for (int i = n - 2; i >= 0; i--) {
      node[i] = compare(node[i * 2 + 1], node[i * 2 + 2]);
    }
  }
  int compare(int a, int b) { return (a | b); }
  void update(int i, int val) {
    i += n - 1;
    node[i] = val;
    while (i > 0) {
      i = (i - 1) / 2;
      node[i] = compare(node[2 * i + 1], node[2 * i + 2]);
    }
  }
  int find(int a, int b, int now = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (r <= a || b < l) return 0;
    if (a <= l && r <= b + 1) return node[now];
    int vl = find(a, b, 2 * now + 1, l, (l + r) / 2);
    int vr = find(a, b, 2 * now + 2, (l + r) / 2, r);
    return compare(vl, vr);
  }
  int number(int m) {
    int tmp = 0;
    while (m > 0) {
      if (m % 2 == 1) tmp++;
      m /= 2;
    }
    return tmp;
  }
};
long long kaijo(long long n) {
  if (n == 0) return 1;
  return n * kaijo(n - 1);
}
long long POW(long long x, long long n) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1 == 1) {
      ans *= x;
    }
    x *= x;
    n >>= 1;
  }
  return ans;
}
long long combination(long long a, long long b) {
  long long tmp;
  tmp = kaijo(a) / (kaijo(b) * kaijo(a - b));
  return tmp;
}
vector<bool> is_prime;
void Eratosthenes(long long n) {
  is_prime.resize(n + 1, true);
  is_prime[0] = false;
  is_prime[1] = false;
  for (long long i = 2; i <= n; i++) {
    if (is_prime[i]) {
      for (long long j = i * i; j <= n; j++) {
        is_prime[j] = false;
      }
    }
  }
}
vector<long long> Prime;
void Prime_Enumeration(long long n) {
  Eratosthenes(n);
  for (int i = 2; i <= n; i++) {
    if (is_prime[i]) {
      Prime.push_back(i);
    }
  }
}
long long gcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return r;
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  long long l = (a * b) / g;
  return l;
}
long long mod(long long a, long long m) { return (a % m + m) % m; }
long long extGCD(long long a, long long b, long long &p, long long &q) {
  if (b == 0) {
    p = 1;
    q = 0;
    return a;
  }
  long long d = extGCD(b, a % b, q, p);
  q -= a / b * p;
  return d;
}
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2,
                                      long long m2) {
  long long p, q;
  long long d = extGCD(m1, m2, p, q);
  if ((b2 - b1) % d != 0) return make_pair(0, -1);
  long long m = m1 * (m2 / d);
  long long tmp = (b2 - b1) / d * p % (m2 / d);
  long long r = mod(b1 + m1 * tmp, m);
  return make_pair(r, m);
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
const long long MOD = 1000000007;
int binary_search(long long *a, long long n, long long key) {
  long long right = n, left = -1;
  long long md = (right + left) / 2;
  while (right - left > 1) {
    if (a[md] <= key) {
      right = md;
    } else {
      left = md;
    }
    md = (right + left) / 2;
  }
  if (left == -1) return -1;
  return right;
}
bool isalpha(char s) {
  if (('A' <= s && s <= 'Z') || ('a' <= s && s <= 'z')) {
    return 1;
  } else {
    return 0;
  }
}
bool Isalpha(string s) {
  long long n;
  bool tmp = true;
  for (int i = 0; i < n; i++) {
    if (isalpha(s[i])) {
      tmp = false;
    }
  }
  return tmp;
}
string YES(bool a) { return a ? "YES" : "NO"; }
string Yes(bool a) { return a ? "Yes" : "No"; }
using Graph = vector<vector<long long>>;
long long f(long long n, long long k) {
  long long tmp;
  tmp = n - k;
  if (tmp < 0) {
    tmp = 0;
  }
  return tmp;
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long ans = k * pow(k, n - 1);
  cout << ans << endl;
  return 0;
}
