#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1000000007;
const long long Maxn = 260;
long long n, k;
long long Fact[Maxn], INV[Maxn];
long long Pow(long long x, long long y) {
  long long Ans = 1;
  for (; y; y >>= 1, x = x * x % Mod)
    if (y & 1) Ans = Ans * x % Mod;
  return Ans;
}
long long C(long long n, long long m) {
  return Fact[n] * INV[m] % Mod * INV[n - m] % Mod;
}
int main() {
  Fact[0] = 1;
  for (long long i = 1; i < Maxn; ++i) Fact[i] = Fact[i - 1] * i % Mod;
  INV[Maxn - 1] = Pow(Fact[Maxn - 1], Mod - 2);
  for (long long i = Maxn - 2; i >= 0; --i) INV[i] = INV[i + 1] * (i + 1) % Mod;
  scanf("%lld%lld", &n, &k);
  long long Ans = 0;
  for (long long i = 0; i <= n; ++i)
    for (long long j = 0; j <= n; ++j) {
      long long Num = (i + j) * n - i * j;
      long long t1 = C(n, i) * C(n, j) % Mod;
      long long Method = t1 * Pow(k - 1, Num) % Mod * Pow(k, n * n - Num) % Mod;
      if ((i + j) % 2 == 0)
        Ans = (Ans + Method) % Mod;
      else
        Ans = (Ans + Mod - Method) % Mod;
    }
  printf("%lld\n", Ans);
  return 0;
}
