#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void f(long long& x) {
  if (x < 0) {
    x %= mod;
    x += mod;
  }
  if (x >= mod) x %= mod;
}
long long g(long long x) {
  f(x);
  return x;
}
long long st(long long a, long long k) {
  if (k == 0) return 1;
  f(a);
  if (k == 1) return a;
  long long tmp = st(a, k / 2);
  tmp = tmp * tmp;
  f(tmp);
  if (k & 1) {
    tmp = tmp * a;
    f(tmp);
  }
  return tmp;
}
long long C[301][301];
void init() {
  C[0][0] = 1;
  for (long long n = 1; n <= 300; ++n) {
    C[n][0] = C[n][n] = 1;
    for (long long k = 1; k < n; ++k) {
      C[n][k] = C[n - 1][k - 1] + C[n - 1][k];
      f(C[n][k]);
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  init();
  long long n, k;
  cin >> n >> k;
  vector<vector<long long> > dp(n + 1, vector<long long>(n + 1, 0));
  for (long long i = 1; i <= n; ++i)
    dp[i][0] = st(g(st(k, n) - st(k - 1, n)), i);
  for (long long j = 1; j <= n; ++j) {
    dp[1][j] = st(k, n - j);
  }
  for (long long i = 2; i <= n; ++i) {
    for (long long j = 1; j <= n; ++j) {
      dp[i][j] = st(k - 1, j);
      dp[i][j] *= dp[i - 1][j];
      f(dp[i][j]);
      dp[i][j] *= g(st(k, n - j) - st(k - 1, n - j));
      long long r = 0;
      f(dp[i][j]);
      for (long long l = 1; l <= j; ++l) {
        long long x = dp[i - 1][j - l];
        x *= C[j][l];
        f(x);
        x *= st(k - 1, j - l);
        f(x);
        r += x;
        f(r);
      }
      r *= st(k, n - j);
      dp[i][j] += g(r);
      f(dp[i][j]);
    }
  }
  cout << dp[n][n] << '\n';
}
