#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

const long long mod = 1000000007;
int N,K; long long D[100100],S[100100];

int main()
{
	scanf ("%d %d",&N,&K); D[0] = 1;
	for (int i=0;i<N;i++){
		int a; scanf ("%d",&a);
		S[0] = D[0];
		for (int j=1;j<=K;j++) S[j] = (S[j-1] + D[j]) % mod;
		for (int j=0;j<=K;j++){
			D[j] = S[j];
			if (j > a) D[j] = (D[j] + mod - S[j-a-1]) % mod;
		}
	}

	printf ("%lld\n",D[K]);

	return 0;
}