#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -f;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  x *= f;
}
void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x) return;
  print(x / 10), putchar(x % 10 + 48);
}
void write(int x) {
  if (!x)
    putchar('0');
  else
    print(x);
  putchar('\n');
}
const int maxn = 1e6 + 10;
const int inf = 1e9;
const double eps = 1e-8;
const int mod = 1e9 + 7;
int n, v, f[300][300], fac[maxn], ifac[maxn], pw1[maxn], pw2[maxn];
int qpow(int a, int x) {
  int res = 1;
  for (; x; x >>= 1, a = 1ll * a * a % mod)
    if (x & 1) res = 1ll * res * a % mod;
  return res;
}
int c(int a, int b) { return 1ll * fac[a] * ifac[b] % mod * ifac[a - b] % mod; }
int main() {
  read(n), read(v);
  fac[0] = ifac[0] = pw1[0] = pw2[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  for (int i = 1; i <= n; i++)
    ifac[i] = 1ll * ifac[i - 1] * qpow(i, mod - 2) % mod;
  for (int i = 1; i <= n; i++)
    pw1[i] = 1ll * pw1[i - 1] * v % mod,
    pw2[i] = 1ll * pw2[i - 1] * (v - 1) % mod;
  for (int i = 1; i <= n; i++)
    f[1][i] = 1ll * c(n, i) * qpow(v - 1, n - i) % mod;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      f[i][j] =
          1ll * f[i - 1][j] * (pw1[j] - pw2[j] + mod) % mod * pw2[n - j] % mod;
      for (int k = 1; k < j; k++)
        f[i][j] = (f[i][j] + 1ll * f[i - 1][k] * c(n - k, j - k) % mod *
                                 pw1[k] % mod * pw2[n - j] % mod) %
                  mod;
    }
  }
  write(f[n][n]);
  return 0;
}
