#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 260;
const long long INF = 2000000100;
const long long MOD = 1000000007;
inline long long mult(long long a, long long b) { return (a * b) % MOD; }
inline long long subt(long long a, long long b) { return (a - b + MOD) % MOD; }
inline long long add(long long a, long long b) { return (a + b) % MOD; }
long long ex(long long n, long long e) {
  long long a = 1;
  long long p = 1;
  long long m = n;
  while (p <= e) {
    if (p & e) a = mult(a, m);
    p *= 2;
    m = mult(m, m);
  }
  return a;
}
long long N, K;
long long ans;
long long comb[MAXN][MAXN];
long long makecomb(int n, int i) {
  if (comb[n][i] != -1) return comb[n][i];
  if (n < i) return i;
  if (i == 0) return 1;
  if (n == i) return 1;
  return add(makecomb(n - 1, i - 1), makecomb(n - 1, i));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N >> K;
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= N; j++) comb[i][j] = -1;
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= N; j++) comb[i][j] = makecomb(i, j);
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= N; j++) {
      if (i == 0 && j == 0) continue;
      long long a = 0;
      long long S = i * N + j * N - i * j;
      a = mult(ex(K - 1, S), ex(K, N * N - S));
      a = mult(a, mult(comb[N][i], comb[N][j]));
      if ((i + j) % 2 == 1) {
        ans = add(ans, a);
      } else {
        ans = subt(ans, a);
      }
    }
  }
  ans = subt(ex(K, N * N), ans);
  cout << ans << "\n";
}
