import sys
input = sys.stdin.readline
N, S = list(map(int, input().split()))
A = list(map(int, input().split()))
#print(N, S)
#print(A)

#dp = [ [0] * (S+1) for i in range(len(A)+1) ]
dp = [ [0] * (len(A)+1) for i in range(S+1) ]

sum_comb = 0
for j in range(len(A), 0, -1):
  for s in range(1, S+1):
    for i in range(j, len(A)+1):
      b = 0
      if A[i-1] == s:
        b = 1
      dp[s][i] = dp[s][i-1] + dp[max(s-A[i-1], 0)][i-1] + b
  #print(dp)
  for i in range(j, len(A)+1):
    sum_comb += dp[s][i]


print(sum_comb)