n,s=map(int,input().split())
a=list(map(int,input().split()))

dp=[[0]*(n+1) for _ in range(s+1)]
for i in range(n+1):
    dp[0][i]=1
ans=0

# i indicade low , c indicade column
for i,w in enumerate(a):
    for c in range(s+1):
        dp[c][i]+=dp[c][i-1]
    for c in range(s-w+1):
        dp[c+w][i]+=dp[c][i-1]
    ans+=dp[-1][i]
    ans%=998244353

print(ans)