package main

import "fmt"

var CYCLE = 1000000007
var N, K int
var a [100]int
var results [100][100001]int

func max(a int, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func main() {
	fmt.Scan(&N, &K)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
	}

	for j := 0; j <= a[N-1] && j <= K; j++ {
		results[N-1][j] = 1
	}

	for i := N - 2; i >= 0; i-- {
		for j := 0; j <= K; j++ {
			r := results[i+1][j]
			if j > 0 {
				r += results[i][j-1]
			}
			if j-1-a[i] >= 0 {
				r -= results[i+1][j-1-a[i]]
			}
			results[i][j] = r % CYCLE
		}
	}

	fmt.Println(results[0][K])

	// for i := 0; i < N; i++ {
	// 	fmt.Println(results[i][:K+1])
	// }
}
