# nadeshino さんの提出（https://atcoder.jp/contests/abc159/submissions/11154139）から
proc getchar_unlocked(): char {.importc: "getchar_unlocked", header: "<stdio.h>", discardable.}
proc scan(): int {.inline.} =
  while true:
    let k = getchar_unlocked()
    if k < '0' or k > '9': return
    result = 10 * result + k.int - '0'.int

const MOD = 998244353

let N, S = scan()

var
  dp: array[0..3000, int]
  result = 0
for _ in 1..N:
  let a = scan()
  dp[0] += 1
  for s in countdown(S - a, 0):
    dp[s + a] += dp[s]
    if dp[s] >= MOD: dp[s] -= MOD
  result += dp[S]
  if result >= MOD: result -= MOD

echo result
