#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  bool f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 0;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ '0');
  if (f) return x;
  return 0 - x;
}
int n, k, f[251], fac[251], ifac[251], ans;
int Pow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = (long long)ret * x % 1000000007;
    x = (long long)x * x % 1000000007;
    y >>= 1;
  }
  return ret;
}
inline int C(int n, int m) {
  return (long long)fac[n] * ifac[m] % 1000000007 * ifac[n - m] % 1000000007;
}
inline void upd(int &x, int y) { x = (x + y) % 1000000007; }
int main() {
  n = read(), k = read();
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) {
    f[i] = Pow((Pow(k, i) - Pow(k - 1, i) + 1000000007) % 1000000007, n),
    fac[i] = (long long)fac[i - 1] * i % 1000000007;
  }
  ifac[n] = Pow(fac[n], 1000000007 - 2);
  for (int i = n - 1; i >= 0; --i)
    ifac[i] = (long long)ifac[i + 1] * (i + 1) % 1000000007;
  for (int i = 0; i <= n; ++i)
    upd(ans, ((i & 1) ? 1000000007 - 1ll : 1ll) * C(n, i) % 1000000007 *
                 Pow(k - 1, (long long)n * i) % 1000000007 * f[n - i] %
                 1000000007);
  cout << ans << endl;
  return 0;
}
