from collections import defaultdict
MOD=998244353

N,S=map(int,input().split())
A=list(map(int,input().split()))
#A=[(v,i) for i,v in enumerate(A)]
A = sorted(A)

ans=0
Q={(0,N+1,0)}
for i,a in enumerate(A):
    tmp=set()
    for val,min_i,max_i in Q:
        tmp.add((val,min_i,max_i))
        if val+a>S:
            continue
        elif val+a==S:
            min_i=min(min_i,i)
            max_i=max(max_i,i)
            r=(min_i+1)*(N-max_i)
            ans+=r
            ans%=MOD
        else:
            tmp.add((val+a,min(min_i,i),max(max_i,i)))
    Q=tmp
print(ans)


