# coding: utf-8

import sys
input = sys.stdin.readline

def f(n, k):
    global 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 = [0] + list(dp[i - 1])
        for j in range(k + 1):
            csum[j + 1] += csum[j]
            csum[j + 1] %= mod
        for j in range(1, k + 1):
            dp[i][j] = csum[j + 1] - csum[max(0, j - a[i])]
            if dp[i][j] < 0:
              dp[i][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))
