from collections import defaultdict
MOD=998244353

N,S=map(int,input().split())
A=list(map(int,input().split()))

ans=0
DP=[[[0]*3 for _ in range(S+1)] for _ in range(N+1)]

DP[0][0][0]=1
for i,a in enumerate(A,1):
    for s in range(S+1):
        DP[i][s][0]+=DP[i-1][s][0]
        DP[i][s][1]+=DP[i-1][s][0]+DP[i-1][s][1]
        DP[i][s][2]+=DP[i-1][s][0]+DP[i-1][s][1]+DP[i-1][s][2]
        for k in range(3): DP[i][s][k]%=MOD
        if s+a<=S:
            DP[i][s+a][1] += DP[i-1][s][0]+DP[i-1][s][1]
            DP[i][s+a][2] += DP[i-1][s][0]+DP[i-1][s][1]

            DP[i][s+a][1]%=MOD
            DP[i][s+a][2]%=MOD

print(DP[N][S][2])

