#include <bits/stdc++.h>
using namespace std;
const int Nmax = 264;
const long long MOD = 1e9 + 7;
long long n, k, f[Nmax][Nmax], C[Nmax][Nmax], p10[Nmax], p9[Nmax];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  p9[0] = p10[0] = 1;
  for (int i = (int)1; i <= (int)Nmax - 1; ++i) {
    p9[i] = (p9[i - 1] * (k - 1)) % MOD;
    p10[i] = (p10[i - 1] * k) % MOD;
  }
  for (int i = (int)0; i <= (int)n; ++i) C[0][i] = 1;
  for (int i = (int)1; i <= (int)n; ++i)
    for (int j = (int)i; j <= (int)n; ++j) {
      C[i][j] = (C[i][j - 1] + C[i - 1][j - 1]) % MOD;
    }
  f[0][0] = 1;
  for (int i = (int)1; i <= (int)n; ++i)
    for (int j = (int)1; j <= (int)n; ++j) {
      for (int t = (int)0; t <= (int)j - 1; ++t) {
        f[i][j] = (f[i][j] +
                   (((f[i - 1][t] * C[j - t][n - t] % MOD) * p10[t]) % MOD) *
                       p9[n - j] % MOD) %
                  MOD;
      }
      f[i][j] = (f[i][j] + ((f[i - 1][j] * ((p10[j] - p9[j] + MOD) % MOD)) %
                            MOD * p9[n - j]) %
                               MOD) %
                MOD;
    }
  cout << f[n][n];
}
