N, K = map(int, input().split()) MOD = 998244353 dp = [[[0, 0] for _ in range(K)] for _ in range(K)] for i in range(K): for j in range(K): if i!=j: dp[i][j] = [1, i+j] for _ in range(N-2): acc0 = [[0] for _ in range(K)] acc1 = [[0] for _ in range(K)] for i in range(K): for j in range(K): acc0[i].append((acc0[i][-1]+dp[j][i][0])%MOD) acc1[i].append((acc1[i][-1]+dp[j][i][1])%MOD) ndp = [[[0, 0] for _ in range(K)] for _ in range(K)] for i in range(K): for j in range(K): if i>j: ndp[i][j][0] += acc0[i][i]-dp[j][i][0] ndp[i][j][1] += acc1[i][i]-dp[j][i][1]+j*ndp[i][j][0] elif i