#include <bits/stdc++.h>
using namespace std;
namespace Elaina {
template <class T>
inline T Max(const T x, const T y) {
  return x < y ? y : x;
}
template <class T>
inline T Min(const T x, const T y) {
  return x < y ? x : y;
}
template <class T>
inline T fab(const T x) {
  return x < 0 ? -x : x;
}
template <class T>
inline void getMax(T& x, const T y) {
  x = Max(x, y);
}
template <class T>
inline void getMin(T& x, const T y) {
  x = Min(x, y);
}
template <class T>
T gcd(const T x, const T y) {
  return y ? gcd(y, x % y) : x;
}
template <class T>
inline T readin(T x) {
  x = 0;
  int f = 0;
  char c;
  while ((c = getchar()) < '0' || '9' < c)
    if (c == '-') f = 1;
  for (x = (c ^ 48); '0' <= (c = getchar()) && c <= '9';
       x = (x << 1) + (x << 3) + (c ^ 48))
    ;
  return f ? -x : x;
}
template <class T>
void fwrit(const T x) {
  if (x < 0) return putchar('-'), fwrit(-x);
  if (x > 9) fwrit(x / 10);
  putchar(x % 10 ^ 48);
}
}  // namespace Elaina
using namespace Elaina;
const int maxn = 250;
const int jzm = 1e9 + 7;
inline int qkpow(int a, int n) {
  int ret = 1;
  for (; n > 0; n >>= 1, a = 1ll * a * a % jzm)
    if (n & 1) ret = 1ll * ret * a % jzm;
  return ret;
}
int fac[maxn + 5];
int inv[maxn + 5];
inline void init() {
  fac[0] = 1;
  for (int i = 1, i_end_ = maxn; i <= i_end_; ++i)
    fac[i] = 1ll * fac[i - 1] * i % jzm;
  inv[maxn] = qkpow(fac[maxn], jzm - 2);
  for (int i = maxn - 1, i_end_ = 1; i >= i_end_; --i)
    inv[i] = 1ll * inv[i + 1] * (i + 1) % jzm;
  inv[0] = 1;
}
inline int C(const int n, const int m) {
  return 1ll * fac[n] * inv[m] % jzm * inv[n - m] % jzm;
}
int n, k;
inline void input() { n = readin(1), k = readin(1); }
signed main() {
  init();
  input();
  int ans = 0;
  for (int i = 0, i_end_ = n; i <= i_end_; ++i)
    for (int j = 0, j_end_ = n; j <= j_end_; ++j) {
      ans += 1ll * ((i + j & 1) ? -1 : 1) * C(n, i) * C(n, j) % jzm *
             qkpow(k - 1, (i + j) * n - i * j) % jzm *
             qkpow(k, (n - i) * (n - j)) % jzm;
      ans = (ans % jzm + jzm) % jzm;
    }
  fwrit(ans), putchar('\n');
  return 0;
}
