// In His Name

#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define gcd __gcd
#define int long long
#define ull unsigned long long

using namespace std;

typedef pair<int, int> pii;

const int MAX = 1e2 + 10, MOD = 1e9 + 7;
int n, k, a[MAX], dp[MAX][MAX];

main (){
	cin >> n >> k;
	for (int i = 1 ; i <= n ; i++)
		cin >> a[i];
	dp[0][0] = 1;
	for (int i = 1 ; i <= n ; i++){
		int sum = 0;
		for (int j = 0 ; j <= k ; j++){
			if (j > a[i]){
				sum += dp[i - 1][j] - dp[i - 1][j - a[i] - 1];
			}
			else {
				sum += dp[i - 1][j];
			}
			dp[i][j] = (sum + MOD) % MOD;
		}
	}
	cout << dp[n][k];
}