import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;

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

long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return (x - y) % mod; }
long modm(long x, long y) { return (x * y) % mod; }

void main()
{
	auto tokens = my_readln().split();
	auto N = tokens[0].to!uint;
	auto K = tokens[1].to!uint;
	auto a = my_readln.split.to!(long[]);

	auto dp = new long[][](105, 100005);
	dp[0][0] = 1;

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

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