#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

using namespace std;
#define chmax(a,b) a=max(a,b)
#define mod 1000000007
#define N 100010
ll f[N],cop[N],n,k;
int main(){
    cin>>n>>k;
    for(int i=0;i<=k;i++)f[i]=0; f[0]=1;
    while(n--){
     ll a;cin>>a;
     ll sum=0;
     for(int i=0;i<=k;i++){
         sum+=f[i];
         if(i-a-1>=0)sum-=f[i-a-1];
         sum%=mod;
         cop[i]=sum;
     }
     for(int i=0;i<=k;i++)f[i]=cop[i];
    }
    ll ans=f[k];
    if(ans<0)ans+=mod;
    cout<<ans<<endl;
 return 0;   
}