#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define nl          '\n'
#if     DEBUG
#define trace(var)  {cerr << "Line " << __LINE__ << ": " << #var << "=" << var << nl;}
#else
#define trace(var)	{}
#endif
#define fori(n)			for(int i = 0; i < n; ++i) 
#define forj(n)			for(int j = 0; j < n; ++j)
#define fork(n)			for(int k = 0; k < n; ++k)
#define forl(n)			for(int l = 0; l < n; ++l)

typedef long long ll;typedef pair<int,int> pii;typedef vector<bool> vbool;typedef vector<int> vint;typedef vector<ll> vll;typedef long double ld;typedef vector<vector<int>> vvi;

const ll N = 101;
const ll K = 100001;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;

int a[N];
int dp[N][K];

/*
//num = # of children, c = # of candies
int solve(int num, int c) {
	if (num == 0) {
		if (c > 0) return 0;
		return 1;
	}
	if (c < 0) return 0;
	if (c == 0) return 1;
	if (mem[num][c] != -1) return mem[num][c];
	ll res = 0;
	fori(a[num-1]+1) {
		res += solve(num-1, c-i);
		res %= MOD;
	}
	return mem[num][c] = res%MOD;
}
*/
int pre[N][K];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, k;
	 
	cin >> n >> k;
	fori(n) cin >> a[i];
	
	fori(N) 
		forj(K) {
			dp[i][j] = -1;
			dp[0][j] = 0;
			dp[i][0] = 1;
		}
	dp[0][0] = 1;

	for(int j = 1; j <= K; ++j)
		pre[0][j] = pre[0][j-1] + dp[0][j-1];
	
	for(int i = 1; i <= n; ++i) {
		for(int j = 0; j <= k; ++j) {
			if (dp[i][j] == -1) {
				dp[i][j] = pre[i-1][j+1]-pre[i-1][max(0, j-a[i-1])];
				dp[i][j] %= MOD;
			}
				
		//cerr << "dp[" << i << "][" << j << "] is " << dp[i][j] << nl;
			pre[i][j+1] = (pre[i][j] + dp[i][j])%MOD;
		//		cerr << "pre[" << i << "][" << j+1 << "] is " << pre[i][j+1] << nl;
		}
	}

	cout << dp[n][k] << nl;
	
	#if DEBUG
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << " s" << nl;
	#endif
	return 0;
}
