#include <bits/stdc++.h>
using namespace std;
const int maxn = 300;
const long long mod = 1e9 + 7;
long long C[maxn][maxn], m1[maxn], m2[maxn];
long long q_pow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ret;
}
int n, m;
long long ans;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
  m1[0] = m2[0] = 1LL;
  for (int i = 1; i < maxn; i++) {
    m1[i] = m1[i - 1] * m % mod;
    m2[i] = m2[i - 1] * (m - 1) % mod;
  }
  for (int i = 0; i <= n; i++) {
    long long t =
        C[n][i] *
        q_pow((m1[n - i] * m2[i] % mod - m2[n] + mod) % mod, (long long)n) %
        mod;
    if (i % 2 == 0)
      ans = (ans + t) % mod;
    else
      ans = (ans - t + mod) % mod;
  }
  printf("%d\n", ans);
  return 0;
}
