#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 30;
const long long INFL = 1LL << 60;
long long MOD = 1000000007;
void pres(double A, long long x = 10) {
  cout << fixed << setprecision(x) << A << endl;
}
void BinarySay(long long x, long long y = 60) {
  for (long long i = 0; i < (y); i++) cout << (x >> (y - 1 - i) & 1);
  cout << endl;
}
long long pow_mod(long long x, long long k) {
  long long res = 1;
  while (k > 0) {
    if (k % 2) {
      res *= x;
      res %= MOD;
    }
    x *= x;
    x %= MOD;
    k /= 2;
  }
  return res;
}
const int MAXcomb = 200010;
long long fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAXcomb; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long comb(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * finv[k] % MOD * finv[n - k] % MOD;
}
long long dp[300][300];
long long po[300];
long long poK[300];
void make_pow(long long K) {
  po[0] = 1;
  poK[0] = 1;
  for (long long i = 0; i < (300); i++) {
    if (i == 0) continue;
    po[i] = po[i - 1] * (K - 1) % MOD;
    poK[i] = poK[i - 1] * K % MOD;
  }
}
int main() {
  COMinit();
  long long N, K;
  cin >> N >> K;
  make_pow(K);
  long long ans = 0;
  dp[0][0] = 1;
  for (long long i = 0; i < (N); i++) {
    for (long long j = 0; j <= N; j++) {
      for (long long nj = j; nj <= N; nj++) {
        long long delta = nj - j;
        if (delta == 0) {
          dp[i + 1][nj] +=
              dp[i][j] * (poK[j] - po[j] + MOD) % MOD * po[N - j] % MOD;
        } else {
          dp[i + 1][nj] += dp[i][j] * poK[j] % MOD * comb(N - j, delta) % MOD *
                           po[N - nj] % MOD;
        }
        dp[i + 1][nj] %= MOD;
      }
    }
  }
  cout << dp[N][N] << endl;
}
