#include <bits/stdc++.h>
using namespace std;
const int maxn = 253, mod = 1000000007;
int Plus(int x, int y) { return (x += y) >= mod ? x - mod : x; }
void Pluseq(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}
int Minus(int x, int y) { return Plus(x, mod - y); }
void Minuseq(int &x, int y) { Pluseq(x, mod - y); }
int mul(long long x, int y) { return x * y % mod; }
void muleq(int &x, int y) { x = mul(x, y); }
int qpow(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) muleq(ans, x);
    muleq(x, x);
    y >>= 1;
  }
  return ans;
}
int inv[maxn];
int main() {
  int n, k, ans = 0, C = 1;
  scanf("%d%d", &n, &k);
  if (k == 1) {
    puts("1");
    return 0;
  }
  int x = mul(k, qpow(k - 1, mod - 2));
  inv[1] = 1;
  for (int i = 2; i <= n + 1; i++) inv[i] = mul(mod - mod / i, inv[mod % i]);
  for (int i = 0, ji = 1; i <= n; i++) {
    ((n + i) & 1 ? Minuseq : Pluseq)(ans, mul(C, qpow(Minus(ji, 1), n)));
    muleq(C, mul(n - i, inv[i + 1]));
    muleq(ji, x);
  }
  muleq(ans, qpow(k - 1, n * n));
  printf("%d\n", ans);
  return 0;
}
