#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
 ll int dp[100001][101];
int main() {

 ll int n,k;
  cin>>n>>k;

  memset(dp,0,sizeof dp);
 ll int a[101];
  for(ll int i=0;i<n;i++)
    cin>>a[i];
  for(ll int i=0;i<n;i++)
    dp[0][i]=1;
//cout<<endl<<endl;  
 //ll int sum=a[0];
  for(int i=0;i<=a[0];i++)
  {dp[i][0]=1;}

for(ll int i=1;i<n;i++)
{
int sums[k+1]={0};
        sums[0]=dp[0][i-1];
        cout<<"sum -> "<<sums[0];
        for(int j=1;j<=k;j++)
        {
            sums[j]=(sums[j-1]+dp[j][i-1])%mod;  
        cout<<" "<<sums[j];
        }
cout<<endl;
for(ll int j=1;j<=k;j++)
{
ll int unreach=j-a[i]-1;
ll int tr=0;
if(unreach>=0)
{
tr=sums[unreach];
}
 dp[j][i]=(sums[j]-tr+mod)%mod;


}



}


 cout<<dp[k][n-1]<<endl;

  

}