#include <bits/stdc++.h>
#pragma GCC optimize(2)
const double esp = 1e-6;
const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int inf = 1e9;
using namespace std;
long long read() {
  char ch = getchar();
  long long x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int mod = 1e9 + 7;
long long quick_pow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans % mod;
}
const int N = 300;
int fac[N];
int inv_fac[N];
int f[N];
int n, k;
void init() {
  fac[0] = 1;
  fac[1] = 1;
  for (int i = 2; i <= n; i++) fac[i] = (1ll * fac[i - 1] * i) % mod;
  inv_fac[n] = quick_pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--)
    inv_fac[i] = (1ll * inv_fac[i + 1] % mod * (i + 1) % mod) % mod;
  for (int i = 0; i <= n; i++)
    f[i] = quick_pow((quick_pow(k, i) - quick_pow(k - 1, i) + mod) % mod, n);
}
long long c(int n, int m) {
  return 1ll * fac[n] % mod * ((1ll * inv_fac[m] * inv_fac[n - m]) % mod) % mod;
}
int main() {
  n = read(), k = read();
  init();
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    if (i & 1)
      ans = (ans -
             (1ll * (1ll * f[n - i] % mod * c(n, i)) % mod *
              quick_pow((long long)k - 1, 1ll * i * n) % mod) +
             mod) %
            mod;
    else
      ans = (ans + (1ll * f[n - i] % mod *
                    (c(n, i) * quick_pow((long long)k - 1, 1ll * i * n) % mod) %
                    mod) %
                       mod);
  }
  printf("%lld\n", ans);
}
