#include <bits/stdc++.h>
using namespace std;
void out(int a, bool ln) { printf("%d%c", a, ln ? '\n' : ' '); }
void out(long long a, bool ln) { printf("%lld%c", a, ln ? '\n' : ' '); }
void out(double a, int digit, bool ln) {
  printf("%.*f%c", digit, a, ln ? '\n' : ' ');
}
void out(long double a, int digit, bool ln) {
  printf("%.*Lf%c", digit, a, ln ? '\n' : ' ');
}
void out0(int a[], int n) {
  for (int i = 0; i < n; i++) out(a[i], i == n - 1);
}
void out1(int a[], int n) {
  for (int i = 1; i <= n; i++) out(a[i], i == n);
}
void out0(long long a[], int n) {
  for (int i = 0; i < n; i++) out(a[i], i == n - 1);
}
void out1(long long a[], int n) {
  for (int i = 1; i <= n; i++) out(a[i], i == n);
}
int in(int &a, int &b, int &c, int &d) {
  return scanf("%d%d%d%d", &a, &b, &c, &d);
}
int in(int &a, int &b, int &c) { return scanf("%d%d%d", &a, &b, &c); }
int in(int &a, int &b) { return scanf("%d%d", &a, &b); }
int in(long long &a, long long &b, long long &c, long long &d) {
  return scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
}
int in(long long &a, long long &b, long long &c) {
  return scanf("%lld%lld%lld", &a, &b, &c);
}
int in(long long &a, long long &b) { return scanf("%lld%lld", &a, &b); }
int in(long long &a) { return scanf("%lld", &a); }
int in(int &a) { return scanf("%d", &a); }
int in(char *s) { return scanf("%s", s); }
int in(char &c) { return scanf("%c", &c); }
int in(double &a) { return scanf("%lf", &a); }
int in(long double &a) { return scanf("%Lf", &a); }
void in0(int a[], int n) {
  for (int i = 0; i < n; i++) in(a[i]);
}
void in1(int a[], int n) {
  for (int i = 1; i <= n; i++) in(a[i]);
}
void in0(long long a[], int n) {
  for (int i = 0; i < n; i++) in(a[i]);
}
void in1(long long a[], int n) {
  for (int i = 1; i <= n; i++) in(a[i]);
}
const double pi = acos(-1);
const double eps = 1e-8;
int sign(double a) { return a < -eps ? -1 : a > eps; }
int db_cmp(double a, double b) { return sign(a - b); }
int inmid(double k1, double k2, double k3) {
  return sign(k1 - k3) * sign(k2 - k3) <= 0;
}
int inf = 0x3f3f3f3f;
long long llinf = 0x3f3f3f3f3f3f3f3f;
long long mod = 1e9 + 7;
const int M = 2.1e5;
const int N = 300;
long long qPow(long long a, long long b, long long c) {
  long long ret = 1;
  while (b) {
    if (b & 0x1) ret = ret * a % c;
    a = a * a % c;
    b >>= 1;
  }
  return ret;
}
long long C[N][N], dp[N][N], K[N], K_1[N];
int main() {
  long long n, k;
  in(n, k);
  for (int i = 0; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      C[i][j] = C[i][j - 1] * (i - j + 1) % mod * qPow(j, mod - 2, mod) % mod;
    }
  }
  K[0] = K_1[0] = 1;
  for (int i = 1; i <= n; i++)
    K[i] = K[i - 1] * k % mod, K_1[i] = K_1[i - 1] * (k - 1) % mod;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      dp[i][j] = dp[i - 1][j] * K_1[n - j] % mod *
                 (((K[j] - K_1[j]) % mod + mod) % mod) % mod;
      for (int x = 0; x < j; x++) {
        dp[i][j] = (dp[i][j] + C[n - x][j - x] * K[x] % mod * K_1[n - j] % mod *
                                   dp[i - 1][x] % mod) %
                   mod;
      }
    }
  }
  out(dp[n][n], 1);
  return 0;
}
