N, K = map(int, input().split())
arr = list(map(int, input().split()))
dp = [[0]*(K+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for k in range(K+1):
        for j in range(arr[i]+1):
            if k-j >= 0:
                dp[i+1][k] += dp[i][k-j]
print(dp[-1][-1])