#include <bits/stdc++.h>
using namespace std;
const int MAX = 250 + 5;
const int MOD = 1e9 + 7;
int add(int a, int b) { return (a + b < MOD) ? (a + b) : (a + b - MOD); }
int sub(int a, int b) { return (a >= b) ? (a - b) : (a - b + MOD); }
int mul(int a, int b) { return (a * 1LL * b) % MOD; }
int expo(int a, int b) {
  int ret = 1;
  while (b != 0) {
    if (b & 1) {
      ret = mul(ret, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return ret;
}
int main() {
  vector<vector<int>> C(MAX, vector<int>(MAX));
  for (int n = 0; n < MAX; n++) {
    for (int r = 0; r <= n; r++) {
      if (n == r or r == 0) {
        C[n][r] = 1;
      } else {
        C[n][r] = add(C[n - 1][r], C[n - 1][r - 1]);
      }
    }
  }
  int n, k;
  scanf("%d %d", &n, &k);
  vector<int> x(MAX), y(MAX);
  x[0] = y[0] = 1;
  for (int i = 1; i < MAX; i++) {
    x[i] = mul(k, x[i - 1]);
    y[i] = mul(k - 1, y[i - 1]);
  }
  vector<vector<int>> dp(n + 1, vector<int>(n + 1));
  int val = sub(x[n], y[n]);
  for (int r = 1; r <= n; r++) {
    dp[r][0] = expo(val, r);
  }
  for (int c = 1; c <= n; c++) {
    dp[1][c] = x[n - c];
  }
  for (int r = 2; r <= n; r++) {
    for (int c = 1; c <= n; c++) {
      int ret = mul(dp[r - 1][c], sub(x[n - c], y[n - c]));
      ret = mul(ret, y[c]);
      for (int c0 = 1; c0 <= c; c0++) {
        int now = mul(C[c][c0], y[c - c0]);
        now = mul(now, dp[r - 1][c - c0]);
        ret = add(ret, mul(now, x[n - c]));
      }
      dp[r][c] = ret;
    }
  }
  printf("%d\n", dp[n][n]);
  return 0;
}
