#include <bits/stdc++.h>
long long power(int a, int k) {
  long long b = a, p = 1;
  while (k > 0) {
    if (k & 1) p = p * b % 1000000007;
    b = b * b % 1000000007;
    k >>= 1;
  }
  return p;
}
int ff[250 + 1], gg[250 + 1];
void init() {
  int i;
  long long f = 1;
  for (i = 0; i <= 250; i++) {
    gg[i] = power(ff[i] = f, 1000000007 - 2);
    f = f * (i + 1) % 1000000007;
  }
}
long long choose(int n, int k) {
  return (long long)ff[n] * gg[k] % 1000000007 * gg[n - k] % 1000000007;
}
int main() {
  int n, k, r, ans;
  init();
  scanf("%d%d", &n, &k);
  ans = 0;
  for (r = 0; r <= n; r++)
    ans = (ans +
           (r % 2 == 0 ? 1 : -1) * choose(n, r) *
               power(power(k - 1, r) * (power(k, n - r) - power(k - 1, n - r)) %
                         1000000007,
                     n)) %
          1000000007;
  if (ans < 0) ans += 1000000007;
  printf("%d\n", ans);
  return 0;
}
