# coding: utf-8
from itertools import accumulate as accum
import sys
input = sys.stdin.readline

def f(n, k, a):
    mod = int(1e9 + 7)
    dp = [[0] * (k + 1) for _ in range(n + 1)]
    for i in range(n + 1):
        dp[i][0] = 1
    for i in range(1, n + 1):
        # csum: Cumulative sum
        # csum[j + 1] = dp[i-1][0] + dp[i-1][1] + ... + dp[i-1][j]
        csum = [0] + [x % mod for x in accum(dp[i - 1])]
        dpi = dp[i]
        for j in range(1, k + 1):
            l = 0 if j < a[i] else j - a[i]
            dpi[j] = csum[j + 1] - csum[l]
            if dpi[j] < 0:
                dpi[j] += mod
    return(dp[n][k])

n, k = map(int, input().split()) # 1 <= n <= 100, 0 <= k <= 10^5
a = list(map(int, input().split()))
a.insert(0, 0)
print(f(n, k, a))
