#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int add(int a, int b) {
  long long x = a + b;
  if (x >= 1000000007) x -= 1000000007;
  if (x < 0) x += 1000000007;
  return x;
}
long long mul(long long a, long long b) { return (a * b) % 1000000007; }
long long pw(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return ans;
}
long long n, k;
long long dp[252][252];
int combi[252][252];
void pascal() {
  combi[0][0] = combi[1][0] = combi[1][1] = 1;
  for (int i = 2; i <= 250; ++i) {
    combi[i][0] = 1;
    for (int j = 1; j <= i; ++j)
      combi[i][j] = add(combi[i - 1][j], combi[i - 1][j - 1]);
  }
}
long long pwk[252], pwk2[252];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  pascal();
  if (k == 1) {
    cout << 1;
    return 0;
  }
  dp[0][0] = 1;
  pwk[0] = pwk2[0] = 1;
  for (int i = 1; i <= 250; ++i) {
    pwk2[i] = mul(pwk2[i - 1], k - 1);
    pwk[i] = mul(pwk[i - 1], k);
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= n; ++j) {
      for (int nxt = j; nxt <= n; ++nxt) {
        long long ways = pwk[j];
        if (nxt > j) {
          long long possibilities = mul(
              dp[i][j], mul(ways, mul(combi[n - j][nxt - j], pwk2[n - nxt])));
          dp[i + 1][nxt] = add(dp[i + 1][nxt], possibilities);
        } else {
          if (j == 0) continue;
          long long waysone = pw(k, j) + 1000000007 - pwk2[j];
          if (waysone >= 1000000007) waysone -= 1000000007;
          long long possibilities = mul(dp[i][j], mul(waysone, pwk2[n - nxt]));
          dp[i + 1][nxt] = add(dp[i + 1][nxt], possibilities);
        }
      }
    }
  }
  cout << dp[n][n] << '\n';
  return 0;
}
