#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7, maxN = 300;
long long int C[maxN][maxN], N, M, K;
inline void getC() {
  C[0][0] = 1;
  for (long long int i = 0; i < maxN; i++) {
    C[i][0] = C[i][i] = 1;
  }
  for (long long int i = 2; i < maxN; i++) {
    for (long long int j = 1; j < i; j++) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
    }
  }
}
long long int modexp(long long int b, long long int e) {
  if (!e) return 1;
  if (!b) return 0;
  long long int r = modexp(b, e / 2);
  r = r * r % MOD;
  if (e % 2) r = r * b % MOD;
  return r;
}
signed main() {
  getC();
  cin >> N >> K;
  long long int r = 0, m, t;
  for (long long int i = 0; i <= N; i++) {
    for (long long int j = 0; j <= N; j++) {
      if (!((i + j) % 2))
        m = 1;
      else
        m = MOD - 1;
      m = (m * modexp(K - 1, N * (i + j) - i * j)) % MOD;
      m = (m * modexp(K, (N - i) * (N - j))) % MOD;
      m = (m * C[N][i]) % MOD;
      m = (m * C[N][j]) % MOD;
      r = (m + r) % MOD;
    }
  }
  cout << r << endl;
}
