import sys
read = sys.stdin.buffer.read
 
mod = 998244353 
U, S, *A = map(int, read().split())

dp = [[[0]*3 for i in range(3001)] for i in range(3001)]

dp[0][0][0] = 1;
for i in range(U):
    for j in range(S+1):
        dp[i+1][j][0] += dp[i][j][0]%mod
        dp[i+1][j][1] += dp[i+1][j][0] + dp[i][j][1]%mod
        dp[i+1][j][2] += dp[i+1][j][1] + dp[i][j][2]%mod
        if j - A[i] >= 0:
            dp[i+1][j][1] += dp[i][j-A[i]][0]%mod + dp[i][j-A[i]][1]%mod
            dp[i+1][j][2] += dp[i][j-A[i]][0]%mod + dp[i][j-A[i]][1]%mod
    
    
print(dp[U][S][2])