#include <bits/stdc++.h>
const long long int mod = 1e9 + 7;
long long int dp1[666666], dp2[666666], dp3[266][266];
int main(void) {
  int n, k;
  scanf("%d%d", &n, &k);
  dp1[0] = 1;
  dp2[0] = 1;
  for (int e = 1; e <= n * n; e++) {
    dp1[e] = (dp1[e - 1] * k) % mod;
    dp2[e] = (dp2[e - 1] * (k - 1)) % mod;
  }
  for (int e = 0; e <= n; e++) dp3[e][e] = 1;
  for (int e = 0; e <= n; e++) dp3[e][0] = 1;
  for (int e = 1; e <= n; e++) {
    for (int p = 1; p < e; p++) {
      dp3[e][p] = (dp3[e - 1][p] + dp3[e - 1][p - 1]) % mod;
    }
  }
  long long int ans = 0;
  for (int e = 0; e <= n; e++) {
    for (int p = 0; p <= n; p++) {
      long long int now = 1;
      now = (now * dp3[n][e]) % mod;
      now = (now * dp3[n][p]) % mod;
      now = (now * dp2[n * e + n * p - e * p]) % mod;
      now = (now * dp1[n * n - n * e - n * p + e * p]) % mod;
      if ((e + p) % 2) now *= -1;
      ans = (ans + now + mod) % mod;
    }
  }
  printf("%lld", ans);
}
