n,s=map(int,input().split())
dp=[[0]*(s+1) for _ in range(n)]
a=list(map(int,input().split()))
if s>=a[0]:dp[0][a[0]]=1
for i in range(1,n):
  if s>=a[0]:dp[i][a[i]]=i+1
  for j in range(s+1):
    dp[i][j]+=dp[i-1][j]
    if j-a[i]>=0:dp[i][j]+=dp[i-1][j-a[i]]
print(sum(dp[i][s]for i in range(n)))