MOD = 998244353 n, k = map(int, input().split()) p = list(map(int, input().split())) dp = [[0] * (k + 1) for _ in range(n + 1)] dp[0][0] = 1 from collections import deque for i in range(1, n + 1): min_deque = deque() max_deque = deque() # j ranges from i-1 down to 0 (window [j..i-1] in 0-based) # we need to check window [j..i-1] (converted to 1-based [j+1..i]) for j in range(i - 1, -1, -1): current = p[j] # Maintain min_deque and max_deque for the current window [j..i-1] while min_deque and p[min_deque[-1]] >= current: min_deque.pop() min_deque.append(j) while max_deque and p[max_deque[-1]] <= current: max_deque.pop() max_deque.append(j) # Compute current min and max current_min = p[min_deque[0]] current_max = p[max_deque[0]] window_length = i - j if current_max - current_min + 1 == window_length: # This window [j..i-1] (0-based) corresponds to [j+1..i] in 1-based for x in range(1, k + 1): dp[i][x] = (dp[i][x] + dp[j][x - 1]) % MOD ans = [dp[n][x] % MOD for x in range(1, k + 1)] print('\n'.join(map(str, ans)))