#include<bits/stdc++.h>
#define maxn 120
#define maxk 120000
using namespace std;
typedef long long LL;
const int mod = 1000000007;
LL s[maxk];
LL f[maxk];
LL a[maxn];
int main(){
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	for(int i = 1; i <= N; i += 1) cin >> a[i];
	f[0] = 1;
	for(int i = 1; i <= N; i += 1){
		for(int j = 0; j <= K; j += 1) s[j] = j ? (s[j - 1] + f[j]) % mod : f[j];
		for(int j = 0; j <= K; j += 1){
			int L = max(0LL, j - a[i]);
			f[j] = (s[j] - (L ? s[L - 1] : 0) + mod) % mod;
		}
	}
	cout << f[K];
}