#include <bits/stdc++.h>
using namespace std;
const int N = 310;
int inf = 1e9;
long long int mod = 1e9 + 7;
inline void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += mod;
}
inline int mul(int a, int b) { return (int)((long long)a * b % mod); }
inline int power(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
inline int inv(int a) {
  a %= mod;
  if (a < 0) a += mod;
  int b = mod, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += mod;
  return u;
}
int ncr[N][N];
int dp[N][N];
void pre() {
  ncr[0][0] = 1;
  for (int i = 1; i < N; i++) {
    ncr[0][i] = 0;
    ncr[i][0] = 1;
  }
  for (int i = 1; i < N; i++) {
    for (int j = 1; j < N; j++) {
      ncr[i][j] = 0;
      add(ncr[i][j], ncr[i - 1][j - 1]);
      add(ncr[i][j], ncr[i - 1][j]);
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      dp[i][j] = -1;
    }
  }
}
int n, k;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pre();
  cin >> n >> k;
  dp[1][0] = power(k, n);
  sub(dp[1][0], power(k - 1, n));
  for (int i = 0; i < n; i++) {
    dp[1][n - i] = power(k, i);
  }
  for (int i = 2; i <= n; i++) {
    int R = power(k, n);
    R -= power(k - 1, n);
    R += mod;
    R %= mod;
    R = power(R, i);
    dp[i][0] = R;
    for (int j = 0; j <= n - 1; j++) {
      dp[i][n - j] = power(k, j);
      sub(dp[i][n - j], power(k - 1, j));
      dp[i][n - j] = mul(dp[i][n - j], power(k - 1, n - j));
      dp[i][n - j] = mul(dp[i][n - j], dp[i - 1][n - j]);
      int temp = 0;
      for (int x = 1; x <= n - j; x++) {
        add(temp, mul(mul(ncr[n - j][x], power(k - 1, n - j - x)),
                      dp[i - 1][n - j - x]));
      }
      temp = mul(temp, power(k, j));
      add(dp[i][n - j], temp);
    }
  }
  cout << dp[n][n] << "\n";
  return 0;
}
