#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
const int MOD = 1000000007;
const int nmax = 101234;
int n, nw, nx = 1;
long long K, dp[2][256], f[256], inv[256], K2[256], K1[256];
long long ksm(long long a, int b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return ans;
}
long long C(int a, int b) { return f[b] * inv[a] % MOD * inv[b - a] % MOD; }
inline void add(long long &a, long long b) {
  a += b;
  if (a > MOD) a -= MOD;
}
int main() {
  scanf("%d%I64d", &n, &K);
  inv[0] = f[0] = 1;
  for (int i = 1; i <= n; ++i) f[i] = f[i - 1] * i % MOD;
  inv[n] = ksm(f[n], MOD - 2);
  for (int i = n - 1; i; --i) inv[i] = inv[i + 1] * (i + 1) % MOD;
  for (int i = 0; i <= n; ++i) {
    K1[i] = ksm(K - 1, i);
    K2[i] = ksm(K, i);
  }
  for (int i = 0; i < n; ++i) dp[nw][i] = C(i, n) * ksm(K - 1, i) % MOD;
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < j; ++k)
        add(dp[nx][k],
            dp[nw][j] * K1[k] % MOD * K2[n - j] % MOD * C(j - k, j) % MOD);
      add(dp[nx][j],
          dp[nw][j] * K1[j] % MOD * (K2[n - j] - K1[n - j] + MOD) % MOD);
    }
    nx = nw;
    nw = 1 - nw;
    memset(dp[nx], 0, sizeof dp[nx]);
  }
  printf("%I64d\n", dp[nw][0]);
}
