#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void MAX(T &x, T y) {
  if (y > x) x = y;
}
template <class T>
inline void MIN(T &x, T y) {
  if (y < x) x = y;
}
template <class T>
inline void rd(T &x) {
  x = 0;
  char o, f = 1;
  while (o = getchar(), o < 48)
    if (o == 45) f = -f;
  do x = (x << 3) + (x << 1) + (o ^ 48);
  while (o = getchar(), o > 47);
  x *= f;
}
const int M = 305;
const int P = 1e9 + 7;
int n, K, fac[M], fac2[M], C[M][M], dp[M][M];
void add(int &x, int y) {
  x += y;
  if (x >= P) x -= P;
}
int main() {
  rd(n), rd(K);
  if (K == 1) {
    puts("1");
    return 0;
  }
  fac[0] = 1;
  fac2[0] = 1;
  for (int i = 1; i < M; i++) fac[i] = 1ll * K * fac[i - 1] % P;
  for (int i = 1; i < M; i++) fac2[i] = 1ll * (K - 1) * fac2[i - 1] % P;
  for (int i = 0; i < M; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % P;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 0; k <= j; k++) {
        if (k == j)
          add(dp[i][j], 1ll * dp[i - 1][k] * (fac[k] - fac2[k] + P) % P *
                            fac2[n - j] % P);
        else
          add(dp[i][j], 1ll * dp[i - 1][k] * C[n - k][j - k] % P * fac[k] % P *
                            fac2[n - j] % P);
      }
    }
  }
  printf("%d\n", dp[n][n]);
  return (0 - 0);
}
