import sys from collections import defaultdict sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N,K = MI() A = LI() mod = 998244353 count = defaultdict(int) for a in A: count[a] += 1 B = list(count.keys()) B.sort() M = len(B) X = [[[0]*(K+1) for _ in range(N+1)] for _ in range(N+1)] # X[i][j][k] = #{(t1,...,ti)|tiは非負整数,t1+...+ti == j,(i-1)*t1+(i-2)*t2+...+0*ti == k} X[0][0][0] = 1 for i in range(1,N+1): for j in range(N+1): for k in range(K+1): X[i][j][k] = X[i-1][j][k] if j >= 1 and k >= i-1: X[i][j][k] += X[i][j-1][k-(i-1)] X[i][j][k] %= mod mod = 998244353 primitive_root = 3 # mod の原始根 roots = [pow(primitive_root,(mod-1) >> i,mod) for i in range(24)] inv_roots = [pow(r,mod-2,mod) for r in roots] # roots[i] = 1 の 2**i 乗根、inv_roots[i] = 1 の 2**i 乗根の逆元 def ntt(A,n): for i in range(n): m = 1 << (n-i-1) for start in range(1 << i): w = 1 start *= m*2 for j in range(m): A[start+j],A[start+j+m] = (A[start+j]+A[start+j+m]) % mod,(A[start+j]-A[start+j+m])*w % mod w *= roots[n-i] w %= mod return A def inv_ntt(A,n): for i in range(n): m = 1 << i for start in range(1 << (n-i-1)): w = 1 start *= m*2 for j in range(m): A[start+j],A[start+j+m] = (A[start+j]+A[start+j+m]*w) % mod,(A[start+j]-A[start+j+m]*w) % mod w *= inv_roots[i+1] w %= mod a = pow(2,n*(mod-2),mod) for i in range(1 << n): A[i] *= a A[i] %= mod return A def convolution(A,B): a,b = len(A),len(B) deg = a+b-2 n = deg.bit_length() N = 1 << n A += [0]*(N-a) # A の次数を 2冪-1 にする B += [0]*(N-b) # B の次数を 2冪-1 にする A = ntt(A,n) B = ntt(B,n) C = [(A[i]*B[i]) % mod for i in range(N)] C = inv_ntt(C,n) return C[:deg+1] dp = [0]*(K+1) # dp[i][j] = 小さい方からi番目の数からなる数列で、転倒数がjであるものの個数(i省略) dp[0] = 1 s = count[B[0]] for i in range(1,M): c = count[B[i]] XX = X[s+1][c] new = convolution(XX,dp)[:K+1] dp = new s += c ans = dp[-1] print(ans)