#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll N = 255, MOD = 1e9 + 7;
ll fac[N], inv_fac[N], comb[N];
ll n, k;
ll bin_exp(ll b, ll e, ll mod) {
  ll ret = 1;
  while (e > 0) {
    if (e & 1) {
      (ret *= b) %= mod;
    }
    (b *= b) %= mod;
    e >>= 1;
  }
  return ret;
}
void func() {
  cin >> n >> k;
  fac[0] = 1;
  for (int i = 1; i <= n; i++) {
    fac[i] = i * fac[i - 1] % MOD;
  }
  inv_fac[n] = bin_exp(fac[n], MOD - 2, MOD);
  for (int i = n; i > 0; i--) {
    inv_fac[i - 1] = i * inv_fac[i] % MOD;
  }
  for (int i = 0; i <= n; i++) {
    comb[i] = fac[n] * inv_fac[n - i] % MOD * inv_fac[i] % MOD;
  }
  ll ans = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      ll x = 1;
      if ((i + j) & 1) {
        x = -1;
      }
      ans += x * comb[i] * comb[j] % MOD * bin_exp(k, (n - i) * (n - j), MOD) %
             MOD * bin_exp(k - 1, n * (i + j) - i * j, MOD) % MOD;
      ans %= MOD;
    }
  }
  cout << (ans + MOD) % MOD << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  int t = 1;
  for (int i = 0; i < t; ++i) {
    func();
  }
}
