#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300;
const long long MOD = 1000000007;
const long long INF = (long long)1e9 + 5;
int N;
long long dp[MAXN][MAXN], K, C[MAXN][MAXN], pw[MAXN], pw2[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K;
  pw[0] = pw2[0] = 1;
  for (int i = 1; i < MAXN; i++) pw[i] = pw[i - 1] * K % MOD;
  for (int i = 1; i < MAXN; i++) pw2[i] = pw2[i - 1] * (K - 1) % MOD;
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j <= i; j++) {
      C[i][j] = (i == j || j == 0 ? 1 : (C[i - 1][j] + C[i - 1][j - 1]) % MOD);
    }
  }
  dp[0][N] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= N; j++) {
      if (!dp[i][j]) continue;
      for (int k = 0; k <= j; k++) {
        dp[i + 1][j - k] =
            (dp[i + 1][j - k] +
             dp[i][j] * C[j][k] % MOD * pw2[j - k] % MOD * pw[N - j] % MOD) %
            MOD;
        if (k == 0) {
          dp[i + 1][j - k] =
              (dp[i + 1][j - k] - dp[i][j] * pw2[N] % MOD + MOD) % MOD;
        }
      }
    }
  }
  cout << dp[N][0] << '\n';
  return 0;
}
