#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f ^= 1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return f ? x : -x;
}
int qp(int x, int n) {
  int ans = 1;
  while (n) {
    if (n & 1) ans = 1LL * ans * x % 1000000007;
    x = 1LL * x * x % 1000000007;
    n >>= 1;
  }
  return ans;
}
int n, k;
int C[255][255];
int mnx[5], mny[5];
int xx;
void dfs(int x, int y) {
  if (y >= n) {
    dfs(x + 1, 0);
    return;
  }
  if (x >= n) {
    bool ok = 1;
    for (int i = 0; i < (int)(n); ++i)
      if (mnx[i] || mny[i]) ok = 0;
    xx += ok;
    return;
  }
  for (int i = 0; i < (int)(k); ++i) {
    int omnx = mnx[x], omny = mny[y];
    mnx[x] = min(mnx[x], i);
    mny[y] = min(mny[y], i);
    dfs(x, y + 1);
    mnx[x] = omnx;
    mny[y] = omny;
  }
}
int main() {
  n = read(), k = read();
  for (int i = 0; i < (int)(n + 1); ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 1000000007;
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)(n + 1); ++i)
    for (int j = 0; j < (int)(n + 1); ++j) {
      int cur = 1LL * C[n][i] * C[n][j] % 1000000007 *
                qp(k - 1, (i + j) * n - i * j) % 1000000007 *
                qp(k, (n - i) * (n - j)) % 1000000007;
      if ((i + j) & 1)
        ans = (ans + 1000000007 - cur) % 1000000007;
      else
        ans = (ans + cur) % 1000000007;
    }
  printf("%d\n", ans);
  return 0;
}
