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: // Problem: E. Arena
  // Contest: Codeforces - Educational Codeforces Round 116 (Rated for Div. 2)
  // URL: https://codeforces.com/contest/1606/problem/E
  // Memory Limit: 256 MB
  // Time Limit: 3000 ms
  // 
  // Powered by CP Editor (https://cpeditor.org)
  
  // Problem: D. Frog Traveler
  // Contest: Codeforces - Codeforces Round #751 (Div. 2)
  // URL: https://codeforces.com/contest/1602/problem/D
  // Memory Limit: 512 MB
  // Time Limit: 2000 ms
  // 
  // Powered by CP Editor (https://cpeditor.org)
  
  import java.io.*;
  import java.util.*;
  
  import static java.lang.Math.max;
  import static java.lang.Math.min;
  import static java.lang.Math.abs;
  
  
  /**
   * zxz 
   * problem link:
   **/
  public class Main {
  	
      //put some data here
  
      /**
       * do some clean action before next testcase
       */
      private void clear() {
  
      }
  
  	void cal(int n, int x){
  		long t = pow_mod(x,n,mod);
  		ans = (ans + t) % mod;
  	}
  	long [][] c;
  	long ans = 0;
  	long mod = 998244353L;
  	long [][] dp;
  	long dfs(int n, int x){
  		if(dp[n][x] >= 0){
  			return dp[n][x];
  		}
  		// System.out.println(n + "-" + x);
  		long res = pow_mod(min(n-1, x),n, mod);
  		// System.out.println("all die" + res);
  		if(x >= n){
  			for(int i = 2; i <= n; i++){
  // System.out.println(i + "  " + pow_mod(n-1,x - i,mod) * Cnm(n,i));
  				long t = pow_mod(n-1,n - i,mod) * c[n][i] % mod;
  				res += t * dfs(i, x - n + 1) % mod;
  				res %= mod;
  			
  			}
  		}
  		dp[n][x] = res;
  		// System.out.println(n + " " + x + " " + res);
  		return res;
  	}
  
      private void solve() throws Exception {
          rf();
          int n = ri();
          int x = ri();
  		dp = new long[n + 1][x + 1];
  		for(int i = 0; i <= n; i++){
  			Arrays.fill(dp[i], -1);
  		}
  		
  		c = new long[n + 1][n + 1];
  		c[0][0]= 1;
  		for(int i = 1; i <= n; i++){
  			c[i][0] = 1;
  			// System.out.print(c[i][0] + " ");
  			for(int j = 1; j <= i; j++){
  				c[i][j] = (c[i - 1][j] + c[i-1][j-1]) % mod ;
  				// System.out.print(c[i][j] + " ");
  			}
  			// System.out.println();
  		}
  		
  		// dfs(n,x);
  		addAns(dfs(n,x));
      }
  
      private void run() throws Exception {
  		
          int T = 1;
  
  		
          while (T-- > 0) {
              solve();
              if (T != 0) {
                  clear();
              }
          }
          printAns();
      }
  
      public static void main(String[] args) throws Exception {
          new Main().run();
      }
  
      StringBuilder sb = new StringBuilder();
      BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
      StringTokenizer strT;
  
  	private void addAns(int a){
  		sb.append(a + "\n");
  	}
  	
  	private void addAns(long a){
  		sb.append(a + "\n");
  	}
  	
  	private void addAns(String s){
  		sb.append(s + "\n");
  	}
  
      private void rf() throws IOException {
          strT = new StringTokenizer(infile.readLine());
      }
  
  
      private int ri() {
          return Integer.parseInt(strT.nextToken());
      }
  
      private long rl() {
          return Long.parseLong(strT.nextToken());
      }
  
  	private char [] rs2c(){
  		return strT.nextToken().toCharArray();
  	}
  	
  	private String rs(){
  		return strT.nextToken();
  	}
  
      private void printAns() {
          System.out.println(sb);
      }
  
      private int[] readArr(int N) throws Exception {
          int[] arr = new int[N];
          rf();
          for (int i = 0; i < N; i++) {
              arr[i] = Integer.parseInt(strT.nextToken());
          }
          return arr;
      }
  
      private void print(int[] arr) {
          //for debugging only
          for (int x : arr) {
              System.out.print(x + " ");
          }
          System.out.println();
      }
      
      private void print(long[] arr) {
          //for debugging only
          for (long x : arr) {
              System.out.print(x + " ");
          }
          System.out.println();
      }
  
      private long[] readArr2(int N) throws Exception {
          long[] arr = new long[N];
          strT = new StringTokenizer(infile.readLine());
          for (int i = 0; i < N; i++) {
              arr[i] = Long.parseLong(strT.nextToken());
          }
          return arr;
      }
  
      private boolean isPrime(long n) {
          if (n < 2) {
              return false;
          }
          if (n == 2 || n == 3) {
              return true;
          }
          if (n % 2 == 0 || n % 3 == 0) {
              return false;
          }
          long sqrtN = (long) Math.sqrt(n) + 1;
          for (long i = 6L; i <= sqrtN; i += 6) {
              if (n % (i - 1) == 0 || n % (i + 1) == 0) {
                  return false;
              }
          }
          return true;
      }
  
      private long gcd(long a, long b) {
          if (a > b) {
              a = (a + b) - (b = a);
          }
          if (a == 0L) {
              return b;
          }
          return gcd(b % a, a);
      }
      
      private int gcd(int a, int b) {
          if (a > b) {
              a = (a + b) - (b = a);
          }
          if (a == 0) {
              return b;
          }
          return gcd(b % a, a);
      }
      
      private double pow(double x, long N) {
          double ans = 1.0;
          // 贡献的初始值为 x
          double x_contribute = x;
          // 在对 N 进行二进制拆分的同时计算答案
          while (N > 0) {
              if (N % 2 == 1) {
                  // 如果 N 二进制表示的最低位为 1，那么需要计入贡献
                  ans *= x_contribute;
              }
              // 将贡献不断地平方
              x_contribute *= x_contribute;
              // 舍弃 N 二进制表示的最低位，这样我们每次只要判断最低位即可
              N /= 2;
          }
          return ans;
      }
      
      long pow_mod(long x, long i, long mod){
  	    if(i == 0){
  	        return 1;
  	    }
  	    long temp = pow_mod(x, i >> 1, mod);
  	    temp = temp * temp % mod;
  	    if((i & 1 )!= 0){
  	        temp = temp * x % mod;
  	    }
  	    return temp;
  	}
      
  
  }
  