#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int dp[255][255];
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return res;
}
long long inv(long long x) { return power(x, mod - 2); }
long long C[255][255], pm[255], pm1[255], m;
void init() {
  int i, j;
  for (i = 0; i < 254; i++) pm[i] = power(m, i), pm1[i] = power(m - 1, i);
  for (i = 0; i <= 251; i++) C[i][0] = C[i][i] = 1;
  for (i = 1; i <= 251; i++) {
    for (j = 1; j <= i; j++) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
}
int main() {
  long long x, n;
  long long i, j, k;
  cin >> n >> m;
  init();
  dp[1][0] = 0;
  for (j = 1; j <= n; j++) {
    dp[1][j] = C[n][j] * power(m - 1, n - j) % mod;
  }
  for (i = 1; i < n; i++) {
    for (j = 1; j <= n; j++) {
      for (k = 0; k <= n - j; k++) {
        dp[i + 1][j + k] =
            (dp[i + 1][j + k] + dp[i][j] * C[n - j][k] % mod * pm1[n - j - k] %
                                    mod * pm[j] % mod) %
            mod;
      }
      dp[i + 1][j] -= dp[i][j] * power(m - 1, n) % mod;
      dp[i + 1][j] = (dp[i + 1][j] + mod) % mod;
    }
  }
  cout << dp[n][n];
}
