#include <bits/stdc++.h>
using namespace std;
int n;
long long k, fk[255 * 255], fkk[255 * 255], c[255][255];
int main() {
  c[1][1] = c[1][0] = 1;
  for (int i = 2; i <= 250; ++i) {
    c[i][0] = 1;
    for (int j = 1; j <= i; ++j)
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 1000000007;
  }
  while (~scanf("%d%lld", &n, &k)) {
    fk[0] = fkk[0] = 1;
    for (int i = 1; i <= n * n; ++i) {
      fk[i] = fk[i - 1] * k % 1000000007;
      fkk[i] = fkk[i - 1] * (k - 1) % 1000000007;
    }
    long long ans = 0;
    for (int i = 0; i <= n; ++i)
      for (int j = 0; j <= n; ++j) {
        if ((i + j) & 1)
          ans = (ans -
                 c[n][i] * c[n][j] % 1000000007 * fk[(n - i) * (n - j)] %
                     1000000007 * fkk[i * n + j * n - i * j] % 1000000007 +
                 1000000007) %
                1000000007;
        else
          ans =
              (ans + c[n][i] * c[n][j] % 1000000007 * fk[(n - i) * (n - j)] %
                         1000000007 * fkk[i * n + j * n - i * j] % 1000000007) %
              1000000007;
      }
    ans = (ans + 1000000007) % 1000000007;
    printf("%lld\n", ans);
  }
  return 0;
}
