#include <cstdio>
#include <algorithm>
using namespace std;
const int mod = 1000000007;
int a[110];
long long dp[100010], s[100010], t[100010];
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	dp[0] = 1;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		for (int j = 0; j <= k; j++) {
			s[j+1] = s[j] + dp[j];
			dp[j] = s[j+1] - s[max(j-a[i],0)];
		}
		for (int j = 0; j <= k; j++) {
			dp[j] = (dp[j] % mod + mod) % mod;
		}
	}
	printf("%lld\n", dp[k]);
	return 0;
}
