import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto A = readln.split.map!(to!int).array;

    auto dp = new long[][](N+1, K+10);
    dp[0][K] = 1;

    foreach (i; 0..N) {
        foreach (j; 0..K+1) {
            (dp[i+1][max(0, j-A[i])] += dp[i][j]) %= MOD;
            (dp[i+1][j+1] -= dp[i][j]) %= MOD;
        }
        foreach (j; 0..K+1) {
            (dp[i+1][j+1] += dp[i+1][j]) %= MOD;
        }
    }

    long ans = (dp[N][0] + MOD) % MOD;
    ans.writeln;
}
