n,s = map(int,input().split())
a = list(map(int,input().split()))
dp = [[[0 for k in range(2)] for i in range(s+1)] for j in range(n+1)]
mod = 998244353
dp[0][0][0] = 1
for i in range(1,n+1):
  x = a[i-1]
  for j in range(1,s+1):
    if j == x:
      dp[i][j][0] += i
      dp[i][j][1] += i
    if j>x:
      dif = dp[i-1][j-x][0]
      dp[i][j][0] = dif
      dp[i][j][1] = dif*(n+1-i)
    dp[i][j][1] = (dp[i][j][1]+dp[i-1][j][1])%mod
    dp[i][j][0] = (dp[i][j][0]+dp[i-1][j][0])%mod
print(dp[n][s][1])