#include <bits/stdc++.h>
#define K 100001
#define N 101
#define M ((ll)1e9+7)
using namespace std;
typedef long long ll;

ll n, k, a[N], dp[K], temp[K];

ll ps(int i, int j, ll *arr) {
	if (i<=0) return arr[j];
	return (arr[j]-arr[i-1]+M+M)%M;
}

int main() {
	cin>>n>>k;
	for (int i=0; i<n; i++) cin>>a[i];
	for (int j=0; j<=k; j++) dp[j]=1;
	temp[0]=1;
	for (int i=0; i<n; i++) {
		for (int j=k; j>0; j--) temp[j]=ps(j-a[i],j,dp);
		for (int j=1; j<=k; j++) dp[j]=(dp[j-1]+temp[j])%M;
	}
	cout<<ps(k,k,dp)<<endl;
}