#include <bits/stdc++.h>
using namespace std;
const int N = 260;
const int MOD = 1e9 + 7;
int n, k, p[N], q[N], c[N][N], f[N][N];
void add(int &x, int y) { (x += y) >= MOD && (x -= MOD); }
void sub(int &x, int y) { (x -= y) < 0 && (x += MOD); }
int add(int x) { return x >= MOD ? x - MOD : x; }
int sub(int x) { return x < 0 ? x + MOD : x; }
int main() {
  cin >> n >> k;
  p[0] = q[0] = c[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    p[i] = 1ll * p[i - 1] * k % MOD;
    q[i] = 1ll * q[i - 1] * (k - 1) % MOD;
    c[i][0] = 1;
    for (int j = 1; j <= i; j++) c[i][j] = add(c[i - 1][j] + c[i - 1][j - 1]);
  }
  f[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 (j == k)
          add(f[i][j],
              1ll * f[i - 1][k] * sub(p[j] - q[j]) % MOD * q[n - j] % MOD);
        else
          add(f[i][j], 1ll * f[i - 1][k] * p[k] % MOD * c[n - k][j - k] % MOD *
                           q[n - j] % MOD);
  cout << f[n][n];
}
