#include <bits/stdc++.h>
using namespace std;
long long N, sol, mod = 1e9 + 7, K, ret;
long long C[252][252];
long long pot(long long n, long long e) {
  if (e == 0) return 1;
  if (e == 1) return n;
  if (e % 2 == 0) {
    long long ret = pot(n, e / 2);
    return ret * ret % mod;
  } else
    return pot(n, e - 1) * n % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 0; i <= 250; i++) C[i][i] = C[i][0] = 1;
  for (int i = 1; i <= 250; i++)
    for (int j = 1; j <= i; j++)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= N; j++)
      if (i + j) {
        long long ins = N * (i + j) - i * j;
        long long out = N * N - ins;
        long long val =
            C[N][i] * C[N][j] % mod * pot(K - 1, ins) % mod * pot(K, out) % mod;
        ret = (ret + val * pot(-1, (i + j + 1) % 2) + mod) % mod;
      }
  cout << (pot(K, N * N) - ret + mod) % mod;
}
