#include <bits/stdc++.h>
using namespace std;
const int MAXN = 257, MOD = 1e9 + 7;
int pk[MAXN * MAXN], pk1[MAXN * MAXN], n, k, f[MAXN][MAXN], C[MAXN][MAXN];
int mul(int a, int b) { return 1LL * a * b % MOD; }
void add(int &a, const int &b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
void sub(int &a, const int &b) {
  a -= b;
  if (a < 0) a += MOD;
}
int subs(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
int pw(int cs, int sm) {
  if (sm == 0) return 1;
  int hpw = pw(cs, sm >> 1);
  hpw = 1LL * hpw * hpw % MOD;
  if (sm & 1) hpw = 1LL * hpw * cs % MOD;
  return hpw;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  pk[0] = pk1[0] = 1;
  for (int i = 1; i <= n * n; ++i) {
    pk[i] = 1LL * pk[i - 1] * k % MOD;
    pk1[i] = 1LL * pk1[i - 1] * (k - 1) % MOD;
  }
  C[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD;
  }
  int res = 0;
  for (int i = 0; i <= n; ++i) {
    int cur = mul(C[n][i], pw(subs(mul(pk[n - i], pk1[i]), pk1[n]), n));
    if (i & 1)
      sub(res, cur);
    else
      add(res, cur);
  }
  cout << res;
  return 0;
}
