# from collections import defaultdict

N, S = map(int, input().split())
A = [int(i) for i in input().split()]

mod = 998244353

dp = [[0] * (S + 1) for _ in range(N + 1)]
dp[0][0] = 0


ret = 0
for i, a in enumerate(A) :
  
  for j in range(S, -1, -1) :
    dp[i + 1][j] += dp[i][j]
    if j >= a :
      if j >= a :
        dp[i + 1][j] += dp[i][j-a]
        if j == S :
          ret += dp[i][j-a] * (N - i)
      if j == a :
        dp[i + 1][j] += i + 1

print(ret)