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

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


let N, S = scan()

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

echo result
