def p_m():
    n, k = map(int, input().split())
    *a, = map(int, input().split())
    mod = 10 ** 9 + 7
    # dp[i][j]はi番目の子にj個の飴を配る方法が何通りかどうか
    dp = [[0] * (k + 1) for _ in range(n + 1)]
    dp[0][0] = 1

    count = 0
    for i in range(n):
        for j in range(min(k + 1, count + 1)):
            count += a[i]
            for m in range(a[i] + 1):
                if j + m > k:
                    break
                dp[i + 1][j + m] += dp[i][j]
                dp[i + 1][j + m] %= mod
    print(dp[n][k])


if __name__ == '__main__':
    p_m()