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: /*
          "Everything in the universe is balanced. Every disappointment
                  you face in life will be balanced by something good for you!
                          Keep going, never give up."
  
  
  */
  
  
  import java.util.*;
  import java.lang.*;
  import java.io.*;
  
  public class Solution {
      static int MAX = 505, MODULO = 998244353;
      static int n, k;
      static long[][] dp = new long[MAX][MAX];
      static long[] factorial = new long[MAX];
      public static void main(String[] args) throws java.lang.Exception {
          out = new PrintWriter(new BufferedOutputStream(System.out));
          sc = new FastReader();
  
          precompute();
  
          int test = 1;
          for (int t = 0; t < test; t++) {
              solve();
          }
          out.close();
      }
  
      private static void precompute() {
          factorial[0] = 1;
          for (int i = 1; i < MAX; i++) {
              factorial[i] = mulMod(factorial[i - 1], i);
          }
      }
  
      private static void solve() {
          n = sc.nextInt();
          k = sc.nextInt();
  
          for (int i = 0; i < MAX; i++) {
              Arrays.fill(dp[i], -1);
          }
  
          long res = fightingArena(n, 1);
          out.println(res);
      }
  
      private static long fightingArena(int rem, int requirement) {
          if (rem == 1) {
              return 0;
          }
          if (rem == 0) {
              return 1;
          }
          if (requirement > k) {
              return 0;
          }
          if (dp[rem][requirement] != -1) {
              return dp[rem][requirement];
          }
          long noOfWays = 0;
          for (int i = 0; i <= rem; i++) {
              long choose = nCr(rem, i);
              long range = Math.min(rem - 1, k - requirement + 1);
              long ways = mulMod(choose, power(range, i));
              ways = mulMod(ways, fightingArena(rem - i, requirement + rem - 1));
              noOfWays = addMod(noOfWays, ways);
          }
          return dp[rem][requirement] = noOfWays;
      }
  
      private static long nCr(int n, int r) {
          if (n < r) {
              return 0;
          }
          long p = factorial[n];
          long q = (factorial[r] * factorial[n - r]) % MODULO;
          p = mulMod(p, power(q, MODULO - 2));
          return p;
      }
  
      private static long addMod(long a, long b) {
          return (a % MODULO + b % MODULO) % MODULO;
      }
  
      private static long subMod(long a, long b) {
          return (a % MODULO - b % MODULO + MODULO) % MODULO;
      }
  
      private static long mulMod(long a, long b) {
          return ((a % MODULO) * (b % MODULO)) % MODULO;
      }
  
      private static long divMod(long a, long b) {
          return mulMod(a, power(b, MODULO - 2));
      }
  
      private static long power(long a, int b) {
          long ans = 1;
          a %= MODULO;
          while (b > 0) {
              if ((b & 1) == 1) {
                  ans *= a;
                  ans %= MODULO;
              }
              b >>= 1;
              a = (a * a) % MODULO;
          }
          return ans;
      }
  
  
      public static FastReader sc;
      public static PrintWriter out;
      static class FastReader
      {
          BufferedReader br;
          StringTokenizer str;
  
          public FastReader()
          {
              br = new BufferedReader(new
                      InputStreamReader(System.in));
          }
  
          String next()
          {
              while (str == null || !str.hasMoreElements())
              {
                  try
                  {
                      str = new StringTokenizer(br.readLine());
                  }
                  catch (IOException  end)
                  {
                      end.printStackTrace();
                  }
              }
              return str.nextToken();
          }
  
          int nextInt()
          {
              return Integer.parseInt(next());
          }
  
          long nextLong()
          {
              return Long.parseLong(next());
          }
  
          double nextDouble()
          {
              return Double.parseDouble(next());
          }
  
          String nextLine()
          {
              String str = "";
              try
              {
                  str = br.readLine();
              }
              catch (IOException end)
              {
                  end.printStackTrace();
              }
              return str;
          }
      }
  }