MOD=998244353
N,S=map(int,input().split())
alist=list(map(int,input().split()))

dp=[[[0]*3 for _ in range(S+1)] for _ 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][1]=dp[i][j][0]+dp[i-1][j][1]
    dp[i][j][2]=dp[i][j][1]+dp[i-1][j][2]
    if j-alist[i-1]>=0:
      tmp=dp[i-1][j-alist[i-1]][0]+dp[i-1][j-alist[i-1]][1]
      dp[i][j][1]+=tmp
      dp[i][j][2]+=tmp
      
    dp[i][j][1]%=MOD
    dp[i][j][2]%=MOD
      
#print(dp)
print(dp[N][S][2])