mod = 998244353 eps = 10**-9 def main(): import sys from collections import Counter input = sys.stdin.readline def calc_k(x, y): res = [0] * (x * y + 1) dp = [[0] * (x * y + 1) for _ in range(x+1)] dp[0][0] = 1 for i in range(y): dp_new = [[0] * (x * y + 1) for _ in range(x+1)] for j in range(x+1): for k in range(j, x+1): for lv in range(x*y+1): lv_new = lv + k if lv_new <= x*y: dp_new[k][lv_new] = (dp_new[k][lv_new] + dp[j][lv])%mod dp = dp_new for j in range(x+1): for lv in range(x*y+1): res[lv] = (res[lv] + dp[j][lv]) % mod return res N, K = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse=True) C = Counter(A) D = {} for a in C: D[a] = 0 inv_max = N * (N - 1) // 2 dp = [0] * (inv_max+1) dp[0] = 1 for i in range(N): dp_new = [0] * (inv_max+1) a = A[i] if D[a]: continue R = calc_k(i, C[a]) for inv in range(inv_max + 1): for j, r in enumerate(R): inv_new = inv + j if inv_new <= inv_max: dp_new[inv_new] = (dp_new[inv_new] + dp[inv] * r)%mod D[a] += 1 dp = dp_new print(dp[K]) if __name__ == '__main__': main()