#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, k, ans;
ll com[255][255];
ll mod(ll a) { return a % 1000000007; }
ll pw(ll a, ll b) {
  if (!b) return 1;
  ll ret = 1;
  if (b & 1) ret = a;
  ll tmp = pw(a, b >> 1);
  return mod(ret * mod(tmp * tmp));
}
void init() {
  for (ll i = 0; i < 255; ++i) {
    com[i][0] = 1;
    for (ll j = 1; j <= i; ++j) {
      com[i][j] = mod(com[i - 1][j - 1] + com[i - 1][j]);
    }
  }
}
int main() {
  cin >> n >> k;
  init();
  for (ll i = 0; i <= n; ++i) {
    for (ll j = 0; j <= n; ++j) {
      ll tmp = mod(
          mod(com[n][i] * com[n][j]) *
          mod(pw(k, (n - i) * (n - j)) * pw(k - 1, n * n - (n - i) * (n - j))));
      if ((i ^ j) & 1)
        ans = mod(ans - tmp + 1000000007);
      else
        ans = mod(ans + tmp);
    }
  }
  cout << ans;
  return 0;
}
