#include <bits/stdc++.h>
using namespace std;
const int N = 251, N2 = N * N, M = 1e9 + 7;
long long kc[N2], k1c[N2], ans, n, k, n2, C[N][N];
int main() {
  cin >> n >> k;
  kc[0] = k1c[0] = 1;
  for (int i = 1; i < N2; i++) {
    kc[i] = kc[i - 1] * k % M;
    k1c[i] = k1c[i - 1] * (k - 1) % M;
  }
  C[0][0] = 1;
  for (int i = 1; i < N; i++) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; j++) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % M;
    }
  }
  n2 = n * n;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      long long t = C[n][j] * C[n][i] % M * kc[n2 - n * (i + j) + i * j] % M *
                    k1c[n * (i + j) - i * j] % M;
      if ((i + j) & 1)
        ans = (ans + M - t) % M;
      else
        ans = (ans + t) % M;
    }
  }
  cout << ans << endl;
  return 0;
}
