#include <bits/stdc++.h>
#define P 1000000007
#define ll long long
#define ld long double
#define N (1<<17)
#define pii pair<int, int>
#define F first
#define S second

using namespace std;

int n, k;
int a[101];
ll d[101][2*N];

int main(){

	cin >> n >> k;

	for(int i=1; i<=n; i++) cin >> a[i];

	d[0][k]++;

	for(int i=1; i<=n; i++){
		for(int j=0; j<=a[i]; j++) d[i][0] = (d[i][0]+d[i-1][j])%P;
		for(int j=1; j<=k; j++){
			d[i][j] = (d[i][j-1]-d[i-1][j-1]+d[i-1][j+a[i]]+P)%P;
		}
	}

	cout << d[n][0] << endl;

	return 0;

}
