#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define f first
#define s second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define debug(x) cout << #x << ":\t" << x << endl
#define _ << " " <<

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const ll N = 1e2 + 3;
const ll M = 1e5 + 3;
const ll mod = 1e9 + 7;

ll n, k, a[N], sum;
ll dp[N][M];

int main() {
//	mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
//	freopen("in", "r", stdin)
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	cin >> n >> k;
	for (ll i = 1; i <= n; ++i) {
		cin >> a[i];
		sum += a[i];
	}
	
	if (sum < k) {
		return cout << 0 << "\n", 0;
	}
	
	for (ll i = 0; i <= n; ++i) dp[i][0] = 1;
	
	for (ll i = 1; i <= n; ++i) {
		for (ll j = 1; j <= k; ++j) {
			auto normalize = [&](ll& x, ll y, ll mod) {
				x -= y;
				if (x < 0) x += mod;
			};
			
			dp[i][j] += (dp[i][j-1] + dp[i-1][j]) % mod;
			if (j > a[i]) {
				ll x = j - a[i] - 1;
				if (i == 3) debug(x);
				normalize(dp[i][j], dp[i-1][x], mod);
			}
		}
	}
	cout << dp[n][k] << "\n";
	
	return 0;
}
