#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, k;
long long dp[260][260][260];
long long c[260][260], b[260], bb[260];
long long ans;
long long qpow(long long xx, long long yy) {
  long long res = 1;
  while (yy) {
    if (yy & 1) {
      res *= xx;
      res %= mod;
    }
    xx *= xx;
    xx %= mod;
    yy >>= 1;
  }
  return res;
}
int main() {
  scanf("%lld%lld", &n, &k);
  c[0][0] = 1;
  b[0] = 1;
  for (int i = 1; i < 260; ++i) {
    c[i][0] = c[i][i] = 1;
    b[i] = b[i - 1] * k;
    bb[i] = bb[i - 1] * (k - 1);
    b[i] %= mod;
    bb[i] %= mod;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      c[j][i] = c[j - 1][i - 1] + c[j - 1][i];
      c[j][i] %= mod;
    }
  }
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= n; ++j) {
      long long num = n * i + n * j - i * j;
      long long val = (c[n][i] * c[n][j] % mod) * qpow(k - 1, num) % mod *
                      qpow(k, n * n - num) % mod;
      if ((i + j) % 2) {
        ans -= val;
      } else {
        ans += val;
      }
      ans = (ans + mod) % mod;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
