#include <bits/stdc++.h>
using namespace std;
const int N = 305, mod = 1e9 + 7;
long long dp[N][N], c[N][N];
void init() {
  c[0][0] = 1LL;
  for (int i = 1; i <= N - 5; i++) {
    c[i][0] = c[i][i] = 1LL;
    for (int j = 1; j <= i - 1; j++)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
  }
}
long long M_1[N], M[N];
int main() {
  int n;
  long long m;
  scanf("%d %lld", &n, &m);
  init();
  M_1[0] = M[0] = 1LL;
  M_1[1] = (m - 1 + mod) % mod;
  M[1] = m % mod;
  for (int i = 2; i <= n; i++)
    M_1[i] = M_1[i - 1] * (m - 1) % mod, M[i] = M[i - 1] * m % mod;
  for (int i = 1; i <= n; i++) dp[1][i] = 1LL * c[n][i] * M_1[n - i] % mod;
  for (int i = 2; i <= n; i++)
    for (int j = 0; j <= n; j++)
      for (int k = 0; k <= j; k++) {
        long long x = 1LL * dp[i - 1][k] * c[n - k][j - k] % mod;
        long long y = 1LL * M_1[n - j] * M[k] % mod;
        dp[i][j] = (dp[i][j] + 1LL * x * y % mod) % mod;
        if (j == k)
          dp[i][j] = (dp[i][j] - 1LL * M_1[n] * dp[i - 1][k] % mod + mod) % mod;
      }
  printf("%d\n", dp[n][n]);
  return 0;
}
