#include <bits/stdc++.h>
using namespace std;
template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
const int mod = 1e9 + 7;
long long bin[555][555];
long long g[555];
int n, k;
long long f[333][333];
long long f2[333][333];
long long go2(int turn, int ja) {
  if (turn + ja <= 0) return 0;
  long long &res = f2[turn][ja];
  if (res >= 0)
    return res;
  else
    res = 0;
  for (int use = 0; use <= ja; use++) {
    long long ways = bin[ja][use];
    int livre = ja - use;
    ways *= g[livre];
    if (turn + use > 0) {
      res += ways;
      res %= mod;
    }
  }
  return res;
}
long long go(int at, int zero, int one) {
  if (at >= n) return (zero == 0);
  long long &res = f[at][zero];
  if (res >= 0)
    return res;
  else
    res = 0;
  for (int turn = 0; turn <= zero; turn++) {
    long long ways = bin[zero][turn];
    int still = zero - turn;
    ways = ways * g[still] % mod;
    ways = ways * go2(turn, one) % mod;
    res += ways * go(at + 1, zero - turn, one + turn) % mod;
    res %= mod;
  }
  return res;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  bin[0][0] = 1;
  for (int i = 1; i <= 300; i++) {
    bin[i][0] = bin[i][i] = 1;
    for (int j = 1; j < i; j++) {
      bin[i][j] = bin[i - 1][j - 1] + bin[i - 1][j];
      if (bin[i][j] >= mod) bin[i][j] -= mod;
    }
  }
  cin >> n >> k;
  g[0] = 1;
  for (int i = 1; i <= 300; i++) {
    g[i] = g[i - 1] * (k - 1) % mod;
  }
  memset(f, -1, sizeof(f));
  memset(f2, -1, sizeof(f2));
  long long ans = go(0, n, 0);
  cout << ans << endl;
  return 0;
}
