n, s = map(int, input().split())
a = list(map(int, input().split()))

dp = [[[] for _2 in range(s + 1)] for _1 in range(n)]

for i, ai in enumerate(a):
  if ai <= s:
    dp[i][ai].append((i, i))
  if i > 0:
    for j, t in enumerate(dp[i-1]):
      for r, l in t:
        dp[i][j].append((r, l))
        if j + ai <= s:
          dp[i][j + ai].append((r, i))
        
print(sum((r + 1) * (n - l) for r, l in dp[n-1][s]))
    