#include<cstdio>
#include<algorithm>
using namespace std;
int n, w[3010], K, D[110][101000], Mod = 1000000007, S[101000];
int main() {
	int i, j, k, a;
	scanf("%d%d", &n,&K);
	D[0][0] = 1;
	for (i = 1; i <= n; i++) {
		scanf("%d", &a);
		for (j = 0; j <= K; j++) {
			S[j + 1] = (S[j] + D[i - 1][j]) % Mod;
		}
		for (j = 0; j <= K; j++) {
			D[i][j] = (S[j + 1] - S[max(0, j - a)] + Mod) % Mod;
		}
	}
	printf("%d\n", D[n][K]);
}