#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ff first 
#define ss second
#define mod 1000000007
#define lim 100005
#define nfs_mw ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main()
{
	nfs_mw;
	int i,j,n,k,v; ll pdp[lim] = {}, pdp2[lim] = {};
	cin>>n>>k;
	pdp[k] = 1;
	for(i=1; i<=n; i++){
		cin>>v;
		pdp2[0] = pdp[v];
		for(j=1; j<=k; j++) pdp2[j] = (((pdp[min(j+v,k)] + (mod - pdp[j-1])%mod)%mod) + pdp2[j-1])%mod;
		swap(pdp,pdp2);
	}
	cout<<pdp[0];
}