package main

import (
	"bufio"
	"fmt"
	"os"
)

const Mod int = 1e9 + 7

func main() {
	N, K := ReadInt(), ReadInt()
	a := ReadInts(N)

	memo := make([][]int, N+1)
	for i := 0; i < N+1; i++ {
		memo[i] = make([]int, K+1)
		for j := 0; j < K+1; j++ {
			memo[i][j] = -1
		}
	}

	// f(i,j) = i番目までの子供に、j個の飴を分け合う場合の数
	var f func(i, j int) int
	f = func(i, j int) int {
		if j == 0 {
			return 1
		}
		if j < 0 {
			return 0
		}
		if i == 0 {
			return 0
		}
		if memo[i][j] > -1 {
			return memo[i][j]
		}
		v := (f(i, j-1) + f(i-1, j)) % Mod
		if j-1-a[i-1] >= 0 {
			v = (v - f(i-1, j-1-a[i-1])) % Mod
		}
		memo[i][j] = v
		return v
	}
	fmt.Println(f(N, K))
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
