import strutils, sequtils
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
proc fin(a: int): Fin = 
  if a >= 0: Fin(a mod Mod)
  else: Fin((a - LowModularZero) mod Mod)
proc `==`(a, b: Fin): bool {.borrow.}
proc `$`(a: Fin): string {.borrow.}
proc `-`(a: Fin): Fin = fin(-int(a))  
template implFinBinOp(f, g, cal: expr) =
  proc f(fa, fb: Fin): Fin {.inline.} =
    let a {.inject.} = int(fa)
    let b {.inject.} = int(fb)
    cal.fin
  template f(fa: Fin; ib): Fin = f(fa, ib.fin)
  template f(ia; fb: Fin): Fin = f(ia.fin, fb)
  template g(fa: var Fin; fb: Fin) = fa = f(fa, fb)
  template g(fa: var Fin; ib) = fa = f(fa, ib.fin)
implFinBinOp(`+`, `+=`, a + b)
implFinBinOp(`-`, `-=`, a - b)
implFinBinOp(`*`, `*=`, a * b)

let n,s = read()
let a = read().rep n

var e = 0.Fin.repeat(s+1)
var f = 0.Fin

for a in a:
  for i in countdown(s-a, 0): e[i+a] += e[i]
  e[a] += 1
  e[0] += 1
  f += e[s]
echo f
