#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
const int N = 256;
inline int Pow(long long x, int p) {
  x %= MOD;
  long long y = 1;
  for (; p; p >>= 1, x = x * x % MOD)
    if (p & 1) y = y * x % MOD;
  return y;
}
int n, ans, k[N], k1[N];
int fac[N], ifac[N];
inline long long C(const int &x, const int &y) {
  return 1ll * fac[x] * ifac[y] % MOD * ifac[x - y] % MOD;
}
int main() {
  scanf("%d %d", &n, &k[1]);
  k[0] = k1[0] = fac[0] = ifac[0] = 1;
  for (int i = 2; i <= n; i++) k[i] = 1ll * k[1] * k[i - 1] % MOD;
  for (int i = 1; i <= n; i++) k1[i] = (k[1] - 1ll) * k1[i - 1] % MOD;
  for (int i = 1; i <= n; i++) fac[i] = 1ll * i * fac[i - 1] % MOD;
  ifac[n] = Pow(fac[n], MOD - 2);
  for (int i = n - 1; i; i--) ifac[i] = (i + 1ll) * ifac[i + 1] % MOD;
  for (int i = 0; i <= n; i++) {
    if (i & 1)
      ans = (ans - C(n, i) * Pow(1ll * k[n - i] * k1[i] - k1[n], n)) % MOD;
    else
      ans = (ans + C(n, i) * Pow(1ll * k[n - i] * k1[i] - k1[n], n)) % MOD;
  }
  printf("%d\n", (ans + MOD) % MOD);
  return 0;
}
