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()) class NTT(): def __init__(self,p): self.p = p self.primitive_root = 1 self.e = 0 if p == 998244353: # 998244353 = 1+119*2^23 self.primitive_root = 3 self.e = 23 elif p == 1012924417: # 1012924417 = 1+483*2^21 self.primitive_root = 5 self.e = 21 elif p == 1224736769: # 1224736769 = 1+73*2^24 self.primitive_root = 3 self.e = 24 self.roots = [pow(self.primitive_root,(p-1) >> i,p) for i in range(self.e+1)] self.inv_roots = [pow(r,p-2,p) for r in self.roots] def ntt(self,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]) % self.p,(A[start+j]-A[start+j+m])*w % self.p w *= self.roots[n - i] w %= self.p return A def inv_ntt(self,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) % self.p,(A[start+j]-A[start+j+m]*w) % self.p w *= self.inv_roots[i+1] w %= self.p a = pow(2,n*(self.p-2),self.p) for i in range(1 << n): A[i] *= a A[i] %= self.p return A def convolution(self,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 にする FA = self.ntt(A,n) FB = self.ntt(B,n) FC = [(FA[i]*FB[i]) % self.p for i in range(N)] C = self.inv_ntt(FC,n) return C[:deg+1] 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 ntt = NTT(mod) 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 = ntt.convolution(XX,dp)[:K+1] dp = new s += c ans = dp[-1] print(ans)