/*input
3 3
abc


*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
inline ll sub(ll a,ll b){
	a -= b;
	if(a < 0)a += MOD;
	return a;
}
ll dp[105][maxn],pref[105][maxn],arr[maxn];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
    	cin>>arr[i];
    }
    for(int i=0;i<=n;i++) dp[i][0]=pref[i][0]=1;
    for(int i=0;i<=k;i++) pref[0][i]=1;
    for(int i=1;i<=n;i++){
    	for(int j=1;j<=k;j++){
    		ll x=(j-arr[i]-1)>=0? pref[i-1][j-arr[i]-1]: 0;
    		dp[i][j]=sub(pref[i-1][j],x);
    		pref[i][j]=pref[i][j-1]+dp[i][j];
    	}
    }
    cout<<dp[n][k];
}