#include <bits/stdc++.h>
using namespace std;
const int N = 255 + 5;
const int MOD = 1e9 + 7;
long long memo[N][N];
long long n, k;
long long powK[N], powKMinus[N], powDoubleK[N];
long long C[N][N];
long long comp(int x, int y) {
  if (y > x) return 0;
  if (x == y) return 1;
  long long &res = C[x][y];
  if (res != -1) return res;
  return res = (comp(x - 1, y - 1) + comp(x - 1, y)) % MOD;
}
long long dp(int r, int c) {
  long long &res = memo[r][c];
  if (res != -1) return res;
  if (c == 0) return powDoubleK[r];
  if (r == 1) return powK[n - c];
  long long ans = 0;
  for (int i = 1; i <= c; ++i) {
    ans +=
        (((((comp(c, i) * powKMinus[c - i]) % MOD) * dp(r - 1, c - i)) % MOD) *
         powK[n - c]) %
        MOD;
    ans %= MOD;
  }
  ans += (((dp(r - 1, c) * powKMinus[c]) % MOD) *
          ((powK[n - c] - powKMinus[n - c] + MOD) % MOD)) %
         MOD;
  ans %= MOD;
  return res = ans;
}
int mat[N][N];
bool check() {
  for (int i = 0; i < n; ++i) {
    bool ok = false;
    for (int j = 0; j < n; ++j) {
      if (mat[i][j] == 1) {
        ok = true;
        break;
      }
    }
    if (!ok) return false;
  }
  for (int i = 0; i < n; ++i) {
    bool ok = false;
    for (int j = 0; j < n; ++j) {
      if (mat[j][i] == 1) {
        ok = true;
        break;
      }
    }
    if (!ok) return false;
  }
  return true;
}
int bruteForce(int i, int j) {
  if (j >= n) {
    j = 0;
    i++;
  }
  if (i >= n) {
    return check();
  }
  int res = 0;
  for (int x = 1; x <= k; ++x) {
    mat[i][j] = x;
    res += bruteForce(i, j + 1);
  }
  return res;
}
int main() {
  cin.sync_with_stdio(false), cin.tie(0), cout.tie(0);
  memset(C, -1, sizeof(C));
  memset(memo, -1, sizeof(memo));
  cin >> n >> k;
  powK[0] = 1;
  powKMinus[0] = 1;
  for (int i = 1; i <= n; ++i) {
    powK[i] = powK[i - 1] * k;
    powKMinus[i] = powKMinus[i - 1] * (k - 1);
    powK[i] %= MOD;
    powKMinus[i] %= MOD;
  }
  powDoubleK[0] = 1;
  long long doubleK = (powK[n] - powKMinus[n] + MOD) % MOD;
  for (int i = 1; i <= n; ++i) {
    powDoubleK[i] = powDoubleK[i - 1] * doubleK;
    powDoubleK[i] %= MOD;
  }
  cout << dp(n, n) << endl;
}
