#include <bits/stdc++.h>
using namespace std;
const int N = 300;
const long long mod = 1e9 + 7;
long long dp[N][N], mi[N], mi_1[N], C[N][N], n, k;
int main() {
  cin >> n >> k;
  for (int i = (0); i <= (n); i++) {
    C[i][0] = 1;
    for (int j = (1); j <= (i); j++)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  }
  mi[0] = mi_1[0] = 1;
  for (int i = (1); i <= (n); i++)
    mi[i] = mi[i - 1] * k % mod, mi_1[i] = mi_1[i - 1] * (k - 1) % mod;
  for (int i = (1); i <= (n); i++) dp[1][i] = C[n][i] * mi_1[n - i] % mod;
  for (int i = (2); i <= (n); i++)
    for (int j = (0); j <= (n); j++)
      for (int s = (0); s <= (j); s++) {
        dp[i][j] = (dp[i][j] + dp[i - 1][s] * C[n - s][j - s] % mod * mi[s] %
                                   mod * mi_1[n - j] % mod) %
                   mod;
        if (j == s)
          dp[i][j] = (dp[i][j] - mi_1[n] * dp[i - 1][s] % mod + mod) % mod;
      }
  cout << dp[n][n];
  return 0;
}
