#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
long long f_pow(long long a, long long b) {
  long long res = 1, temp = a;
  while (b) {
    if (b & 1) res = res * temp % mod;
    temp = temp * temp % mod;
    b >>= 1;
  }
  return res;
}
long long C[255][255];
void build() {
  for (int i = 0; i < 255; 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]) % mod;
    }
  }
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  long long res = 0;
  build();
  for (int i = 0; i <= 2 * n; i++) {
    for (int j = 0; j <= i && j <= n; j++) {
      int a = j, b = i - j;
      if (a <= n && b <= n) {
        long long pro = C[n][a] * C[n][b] % mod;
        long long num = a * n + b * n - a * b;
        long long Less = n * n - num;
        if (i & 1) {
          res -= pro * f_pow(k - 1, num) % mod * f_pow(k, Less) % mod;
        } else {
          res += pro * f_pow(k - 1, num) % mod * f_pow(k, Less) % mod;
        }
        res = (res % mod + mod) % mod;
      }
    }
  }
  printf("%lld\n", res);
  return 0;
}
