#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 100005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,dp[104][li],PS[li];
int cev;
string s;
vector<int> v;

inline int add(int x,int y){
	if(x+y>=mod)return x+y-mod;
	return x+y;
}

main(void){
	scanf("%lld %lld",&n,&k);
	FOR{
		scanf("%lld",&a[i]);
	}
	PS[0]=1;
	dp[1][0]=1;
	for(int i=1;i<=a[1];i++){dp[1][i]=1;PS[i]=add(PS[i-1],1);}
	for(int i=a[1]+1;i<=k;i++)PS[i]=PS[i-1];
	for(int i=2;i<=n;i++){
		dp[i][0]=1;
		for(int j=1;j<=k;j++){
			if(j<=a[i])dp[i][j]=PS[j];
			else dp[i][j]=PS[j]-PS[j-a[i]-1];
		}
		for(int j=1;j<=k;j++)PS[j]=add(PS[j-1],dp[i][j]);
		//~ cout<<"**"<<PS[4]<<" : : "<<dp[2][1]<<"**"<<endl;
	}
	printf("%lld\n",dp[n][k]);
	return 0;
}
