import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    dp=[0]*(k+1)
    dp[k]=1
    for i in range(n):
        ndp=[0]*(k+1)
        # dpの累積和を取っておく
        S=[0]*(k+2)
        for j in range(k+1): S[j+1]=S[j]+dp[j]
        # iterete
        for j in range(k+1):
            ndp[j]=S[min(j+A[i]+1,k+1)]-S[j]
        dp=ndp
    print(dp[0])
resolve()