N,S =map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
ans=0
q=[0]*(S+1)
for i in range(N):
    q[0]+=1
    q2=[0]*(S+1)
    for j in range(S+1):
        q[j]%=mod
        q2[j]+=q[j]
        if (j + A[i]) <= S:
            q2[j+A[i]]+=q[j]
    q = q2
    ans+=q[S]
    ans%=mod
print(ans)
