n,s=map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
dp = [[[0 for i in range(2)] for i in range(s+1)]for i in range(n+1)]
dp[0][0][0]=0

for i in range(1,n+1):
    for j in range(s+1):
        if j==0:
            b=1
        else:
            b=0
        dp[i][j][0] += (dp[i-1][j][0]+b)
        dp[i][j][0] %= mod
        dp[i][j][1] += (dp[i-1][j][1]+dp[i-1][j][0]+b)
        dp[i][j][1] %= mod
        if j+a[i-1]<=s:
            dp[i][j+a[i-1]][0] += (dp[i-1][j][0]+b)
            dp[i][j][0] %= mod
            dp[i][j+a[i-1]][1] += (b+dp[i-1][j][0])
            dp[i][j][1] %= mod


print(dp[n][s][1])
