MOD = 998244353


def main():
    N, S = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    dp = [[0]*(S+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        for j in range(S+1):
            dp[i+1][j] += dp[i][j]
            if j + A[i] <= S:
                dp[i+1][j+A[i]] += dp[i][j]

    # A = A[::-1]
    # dp2 = [[0]*(S+1) for _ in range(N+1)]
    # dp2[0][0] = 1
    # for i in range(N):
    #     for j in range(S+1):
    #         dp2[i+1][j] += dp2[i][j]
    #         if j + A[i] <= S:
    #             dp2[i+1][j+A[i]] += dp2[i][j]
    ans = 0
    for i in range(1, N):
        pre = dp[i][S] - dp[i-1][S]
        post = dp[i+1][S] - dp[i][S]
        ans += pre*i - post*(N-i)
    ans += (dp[N][S] - dp[N-1][S])*N
    print(ans-1)


if __name__ == '__main__':
    main()
