#include <bits/stdc++.h>
using namespace std;
const int N = 257, P = 1e9 + 7;
int read() {
  int s = 0, w = 1;
  char c;
  while (c = getchar(), c > '9' || c < '0')
    if (c == '-') w = -1;
  while (c >= '0' && c <= '9') s = s * 10 + c - '0', c = getchar();
  return s * w;
}
void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 | '0');
}
void wsp(int x) {
  write(x);
  putchar(' ');
}
void wln(int x) {
  write(x);
  putchar('\n');
}
int n, K, ans;
int C[N][N];
int ksm(int a, int b) {
  int s = 1;
  for (; b; b >>= 1, a = 1ll * a * a % P)
    if (b & 1) s = 1ll * s * a % P;
  return s;
}
int solve(int i, int j) {
  int s = i * n + j * n - i * j;
  return 1ll * ksm(K - 1, s) * ksm(K, n * n - s) % P;
}
signed main() {
  n = read();
  K = read();
  C[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= n; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % P;
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) {
      if (i + j & 1)
        ans = (ans - 1ll * C[n][i] * C[n][j] % P * solve(i, j) % P + P) % P;
      else
        ans = (ans + 1ll * C[n][i] * C[n][j] % P * solve(i, j) % P) % P;
    }
  wln(ans);
}
