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

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

#tmp = [[dp[i][j][2]for j in range(s+1)]for i in range(n+1)]
#print(tmp)

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