#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
 
#include <stdio.h>
#include <bits/stdc++.h>
 
using namespace std;
 
#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  
#define pb push_back
#define mp make_pair
#define in insert
#define f first
#define s second
#define ll long long
#define dd double
  
const int mod = 1e9 + 7;
const int N = 2e5 + 7;
const int inf = 2e9;
const ll INF = 1e18;

ll a[200], dp[200][202020];
ll sum[200][202020];

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	// freopen("*.in", "r", stdin);freopen("*.out", "w", stdout);
	ll n, k;
	cin >> n >> k;
	for (ll i = 1; i <= n; i++) cin >> a[i];

	for (ll i = 0; i <= a[1]; i++) dp[1][i] = 1;

	for (ll i = 2; i <= n; i++) {
		for (ll x = 0; x <= k; x++) {
			if(x == 0) sum[i - 1][x] = dp[i - 1][x] % mod;
			else sum[i - 1][x] = (sum[i - 1][x - 1] + dp[i - 1][x]) % mod;
		}
		for (ll j = 0; j <= k; j++) {
			if(j - a[i]) dp[i][j] = (sum[i - 1][j] - sum[i - 1][j - a[i] - 1]) % mod;
			else dp[i][j] = sum[i - 1][j] % mod;
		}
	}

	cout << dp[n][k];
}