import sys
input = sys.stdin.buffer.readline

def main():
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    MOD = 10**9+7
    
    dp = [0 for _ in range(K+2)]
    dp[0] = 1
    for num in a:
        imos = [0 for _ in range(K+2)]
        for i in range(K+2):
            imos[i] += dp[i]
            imos[min(K+1,i+num+1)] -= dp[i]
        for i in range(K+1):
            imos[i+1] += imos[i]
            imos[i+1] %= MOD
        dp = imos
        
    print(dp[K])
        
if __name__ == "__main__":
    main()
