from strutils import parseInt, split
from sequtils import newSeqWith, map

const MOD = 998244353
proc `+=`(a: var int; b: int) =
  system.`+=`(a, b)
  if a >= MOD: a -= MOD
proc `*`(a, b: int): int = system.`*`(a, b) mod MOD


var N, S: int; (N, S) = stdin.readLine.split.map(parseInt)
let A = stdin.readLine.split.map(parseInt)

var
  result = 0
  dp = newSeqWith(N + 1, newSeq[int](S + 1))
dp[0][0] = 1
for i, a in A:
  result += dp[i][S - a] * (N - i)
  dp[i + 1][0] += 1
  for s in 0..S:
    dp[i + 1][s] += dp[i][s]
    if s >= a: dp[i + 1][s] += dp[i][s - a]

echo result
