#include <bits/stdc++.h>
using namespace std;

const int maxn = 110, maxm = 1e5 + 10, P = 1e9 + 7;
int n, k, s[maxm], f[maxn][maxm];

int main() {
	scanf("%d %d", &n, &k), f[0][0] = 1;
	for (int i = 1, x; i <= n; i++) {
		scanf("%d", &x), s[0] = f[i - 1][0];
		for (int j = 1; j <= k; j++) {
			s[j] = (s[j - 1] + f[i - 1][j]) % P;
		}
		for (int j = 0; j <= k; j++) {
			f[i][j] = (s[j] - (j - x > 0 ? s[j - x - 1] : 0) + P) % P;
		}
	}
	printf("%d", f[n][k]);
	return 0;
}