#include <bits/stdc++.h>
using namespace std;
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
template <class T>
void read(T& x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
  x *= f;
}
template <class T, class... Args>
void read(T& x, Args&... args) {
  read(x), read(args...);
}
template <class T>
void write(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int MAXN = 255;
const int MOD = 1E9 + 7;
long long n, k, g[MAXN][MAXN], fac[MAXN], inv[MAXN];
long long qpow(long long a, long long b, long long MOD) {
  long long ans = 1, base = a;
  while (b) {
    if (b & 1) ans = ans * base % MOD;
    b >>= 1, base = base * base % MOD;
  }
  return ans;
}
long long C(long long n, long long m) {
  return fac[n] * inv[m] % MOD * inv[n - m] % MOD;
}
void solve(int caseNum) {
  cin >> n >> k;
  fac[0] = inv[0] = 1;
  for (int i = 1; i <= n; i++)
    fac[i] = fac[i - 1] * i % MOD, inv[i] = qpow(fac[i], MOD - 2, MOD);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++)
      g[i][j] = C(n, i) * C(n, j) % MOD *
                qpow(k - 1, n * (i + j) - i * j, MOD) % MOD *
                qpow(k, n * n - n * (i + j) + i * j, MOD) % MOD;
  long long ans = 0;
  for (int x = 0; x <= n; x++)
    for (int y = 0; y <= n; y++)
      ans = (ans + (((x + y) & 1 ? -1 : 1) * g[x][y])) % MOD;
  cout << (ans + MOD) % MOD;
}
signed main() {
  int testCase = 1;
  for (int i = 1; i <= testCase; i++) solve(i);
  return 0;
}
