//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;
     
using namespace std;

int n, q, k, dp[101][maxn], pref[101][maxn], a[maxn];

int get(int x, int l, int r){
	if (l <= 0)
		return pref[x][r];
	return pref[x][r] - pref[x][l - 1];
}

void solve(){
	cin >> n >> k;

	for (int i = 1; i <= n; i++)
		cin >> a[i];

	dp[0][0] = 1;
	for(int i = 0; i <= k; i++)
		pref[0][i] = 1;

	for (int i = 1; i <= n; i++){
		for (int j = 0; j <= k; j++){
			dp[i][j] += (get(i - 1, j - a[i], j) + mod) % mod; //cerr << dp[i][j] << " ";
			//cout << get(i, j - a[i], j) << j - a[i] << " " << j << endl;
			//return;
		}
		//cout << endl;
		pref[i][0] = dp[i][0];
		for (int j = 1; j <= k; j++)
			pref[i][j] = (pref[i][j - 1] + dp[i][j]) % mod;
	}

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

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}
