import strutils, sequtils, math
let get = iterator: string {.closure.} =
  for s in stdin.readAll.split: yield s
proc read: int {.inline.} = get().parseInt
template rep(a,b): seq = newSeqWith(b,a)

const Mod = 998244353
const LowModularZero: int = int.low div Mod * Mod
type Fin = distinct int
converter toFin(a: int): Fin = 
  if a >= 0: Fin(a mod Mod)
  else: Fin((a - LowModularZero) mod Mod)
converter toInt(a: Fin): int = a.int
proc `==`(a, b: Fin): bool {.borrow.}
proc `$`(a: Fin): string {.borrow.}
proc `-`(a: Fin): Fin = - a.int
proc `+`(a, b: Fin): Fin {.inline.} = a.int + b.int
proc `-`(a, b: Fin): Fin {.inline.} = a.int - b.int
proc `*`(a, b: Fin): Fin {.inline.} = a.int * b.int
proc euc(a, b: int): tuple[x, y, g: int] =
  if b == 0: return (x: 1, y: 0, g: a)
  let (x, y, g) = euc(b, a mod b)
  (x: y, y: x - a div b * y, g: g)
proc `/`(a, b: Fin): Fin = a.int * euc(b, Mod).x
template implFinAssign(calc, assign) =
  proc assign(a: var Fin; b: Fin) {.inline.} = a = calc(a,b)
implFinAssign(`+`, `+=`)
implFinAssign(`-`, `-=`)
implFinAssign(`*`, `*=`)
implFinAssign(`/`, `/=`)

let n, s = read()
var dp = 0.Fin.repeat 3001
var ans = 0.Fin
for _ in 1..n:
  let a = read()
  for i in countdown(s, a): dp[i] += dp[i-a]
  dp[0] += 1; dp[a] += 1; ans += dp[s]
echo ans