import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;

string my_readln() { return chomp(readln()); }

void main()
{
	auto tokens = my_readln().split();
	auto N = tokens[0].to!uint;
	auto K = tokens[1].to!uint;
	long[] a;
	long l;
	foreach (token; my_readln.split)
	{
		a ~= token.to!long;
		l += a[$-1];
	}

	long mod = pow(10, 9) + 7;
	auto dp = new long[][](105, 100005);
	dp[0][0] = 1;

	foreach (i; 0..N)
	{
		long s = 0;
		foreach (j; 0..K+1)
		{
			if (j > a[i])
				s = (s + (dp[i][j] - dp[i][j-a[i]-1])) % mod;
			else
				s = (s + dp[i][j]) % mod;
			dp[i+1][j] = (dp[i+1][j] + s) % mod;
		}
	}

	writeln(dp[N][K]);
	stdout.flush();
}