description: There are n heroes fighting in the arena. Initially, the i-th hero has a_i health points.
  
  The fight in the arena takes place in several rounds. At the beginning of each round, each alive hero deals 1 damage to all other heroes. Hits of all heroes occur simultaneously. Heroes whose health is less than 1 at the end of the round are considered killed.
  
  If exactly 1 hero remains alive after a certain round, then he is declared the winner. Otherwise, there is no winner.
  
  Your task is to calculate the number of ways to choose the initial health points for each hero a_i, where 1 ≤ a_i ≤ x, so that there is no winner of the fight. The number of ways can be very large, so print it modulo 998244353. Two ways are considered different if at least one hero has a different amount of health. For example, [1, 2, 1] and [2, 1, 1] are different.
  
  Input
  
  The only line contains two integers n and x (2 ≤ n ≤ 500; 1 ≤ x ≤ 500).
  
  Output
  
  Print one integer — the number of ways to choose the initial health points for each hero a_i, where 1 ≤ a_i ≤ x, so that there is no winner of the fight, taken modulo 998244353. 
  
  Examples
  
  Input
  
  
  2 5
  
  
  Output
  
  
  5
  
  
  Input
  
  
  3 3
  
  
  Output
  
  
  15
  
  
  Input
  
  
  5 4
  
  
  Output
  
  
  1024
  
  
  Input
  
  
  13 37
  
  
  Output
  
  
  976890680
solution: #include <bits/stdc++.h>
  using namespace std;
  void _print(long long t) { cerr << t; }
  void _print(string t) { cerr << t; }
  void _print(char t) { cerr << t; }
  void _print(long double t) { cerr << t; }
  void _print(double t) { cerr << t; }
  void _print(unsigned long long t) { cerr << t; }
  template <class T, class V>
  void _print(pair<T, V> p);
  template <class T>
  void _print(vector<T> v);
  template <class T>
  void _print(set<T> v);
  template <class T, class V>
  void _print(map<T, V> v);
  template <class T>
  void _print(multiset<T> v);
  template <class T, class V>
  void _print(pair<T, V> p) {
    cerr << "{";
    _print(p.first);
    cerr << ",";
    _print(p.second);
    cerr << "}";
  }
  template <class T>
  void _print(vector<T> v) {
    cerr << "[ ";
    for (T i : v) {
      _print(i);
      cerr << " ";
    }
    cerr << "]";
  }
  template <class T>
  void _print(set<T> v) {
    cerr << "[ ";
    for (T i : v) {
      _print(i);
      cerr << " ";
    }
    cerr << "]";
  }
  template <class T>
  void _print(multiset<T> v) {
    cerr << "[ ";
    for (T i : v) {
      _print(i);
      cerr << " ";
    }
    cerr << "]";
  }
  template <class T, class V>
  void _print(map<T, V> v) {
    cerr << "[ ";
    for (auto i : v) {
      _print(i);
      cerr << " ";
    }
    cerr << "]";
  }
  const long long INF = 1e18;
  const int32_t M = 1e9 + 7;
  const int32_t MM = 998244353;
  long long gcd(long long a, long long b) {
    if (b > a) {
      return gcd(b, a);
    }
    if (b == 0) {
      return a;
    }
    return gcd(b, a % b);
  }
  long long expo(long long a, long long b, long long mod) {
    long long res = 1;
    while (b > 0) {
      if (b & 1) res = (res * a) % mod;
      a = (a * a) % mod;
      b = b >> 1;
    }
    return res;
  }
  void extendgcd(long long a, long long b, long long *v) {
    if (b == 0) {
      v[0] = 1;
      v[1] = 0;
      v[2] = a;
      return;
    }
    extendgcd(b, a % b, v);
    long long x = v[1];
    v[1] = v[0] - v[1] * (a / b);
    v[0] = x;
    return;
  }
  vector<long long> sieve(long long n) {
    long long *arr = new long long[n + 1]();
    vector<long long> vect;
    for (long long i = 2; i <= n; i++)
      if (arr[i] == 0) {
        vect.push_back(i);
        for (long long j = 2 * i; j <= n; j += i) arr[j] = 1;
      }
    return vect;
  }
  long long mminv(long long a, long long b) {
    long long arr[3];
    extendgcd(a, b, arr);
    return arr[0];
  }
  long long mminvprime(long long a, long long b) { return expo(a, b - 2, b); }
  long long mod_add(long long a, long long b, long long m) {
    a = a % m;
    b = b % m;
    return (((a + b) % m) + m) % m;
  }
  long long mod_mul(long long a, long long b, long long m) {
    a = a % m;
    b = b % m;
    return (((a * b) % m) + m) % m;
  }
  long long mod_sub(long long a, long long b, long long m) {
    a = a % m;
    b = b % m;
    return (((a - b) % m) + m) % m;
  }
  long long mod_div(long long a, long long b, long long m) {
    a = a % m;
    b = b % m;
    return (mod_mul(a, mminvprime(b, m), m) + m) % m;
  }
  long long phin(long long n) {
    long long number = n;
    if (n % 2 == 0) {
      number /= 2;
      while (n % 2 == 0) n /= 2;
    }
    for (long long i = 3; i <= sqrt(n); i += 2) {
      if (n % i == 0) {
        while (n % i == 0) n /= i;
        number = (number / i * (i - 1));
      }
    }
    if (n > 1) number = (number / n * (n - 1));
    return number;
  }
  const long long NC = 501;
  long long fact[NC], ifact[NC], inv[NC];
  struct comb_init {
    comb_init() {
      inv[1] = 1;
      for (long long i = 2; i < NC; ++i) {
        inv[i] = (MM - MM / i) * inv[MM % i] % MM;
      }
      fact[0] = ifact[0] = 1;
      for (long long i = 1; i < NC; ++i) {
        fact[i] = fact[i - 1] * i % MM;
        ifact[i] = ifact[i - 1] * inv[i] % MM;
      }
    }
  } comb_init_;
  long long combination(long long n, long long r, long long m) {
    if (n < r || r < 0) return 0;
    long long val1 = fact[n];
    long long val2 = ifact[n - r];
    long long val3 = ifact[r];
    return (((val1 * val2) % m) * val3) % m;
  }
  template <typename T1, typename T2>
  istream &operator>>(istream &in, pair<T1, T2> &a) {
    in >> a.first >> a.second;
    return in;
  }
  template <typename T1, typename T2>
  ostream &operator<<(ostream &out, pair<T1, T2> a) {
    out << a.first << " " << a.second;
    return out;
  }
  template <typename T, typename T1>
  T amax(T &a, T1 b) {
    if (b > a) a = b;
    return a;
  }
  template <typename T, typename T1>
  T amin(T &a, T1 b) {
    if (b < a) a = b;
    return a;
  }
  const long long N = 0;
  long long dp[500 + 1][500 + 1];
  long long help(long long n, long long lower, long long k) {
    if (n == 1) return 0;
    if (n == 0) return 1;
    if (lower > k) return 0;
    if (dp[n][lower] != -1) {
      return dp[n][lower];
    }
    long long ans = 0;
    for (long long i = 0; i <= n; i++) {
      long long waysToPick = combination(n, i, MM);
      long long waysToAssign = expo(min(k - lower + 1, n - 1), i, MM);
      ans +=
          mod_mul(waysToPick * waysToAssign, help(n - i, lower + n - 1, k), MM);
      ans %= MM;
    }
    dp[n][lower] = mod_add(ans, 0, MM);
    return ans;
  }
  void solve() {
    long long n, k;
    cin >> n >> k;
    if (k < n) {
      cout << expo(k, n, MM) << endl;
    } else {
      for (long long i = 0; i <= n; i++) {
        for (long long j = 0; j <= k; j++) {
          dp[i][j] = -1;
        }
      }
      cout << help(n, 1, k) << endl;
    }
  }
  signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long t = 1;
    while (t--) solve();
    return 0;
  }
  