#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n,k,a[109];
long long dp[109][100009],sdp[109][100009];
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)cin>>a[i];
    //sort(a,a+n+1);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=a[i]&&j<=k#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n,k,a[109];
long long dp[109][100009],sdp[109][100009];
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)cin>>a[i];
    //sort(a,a+n+1);
    
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=a[i];j++)
        {
            dp[i][j]++;
            dp[i][j]=(dp[i][j]+sdp[i-1][j])%mod;
            sdp[i][j]=(dp[i][j]+sdp[i][j-1])%mod;
        }
        for(int j=a[i]+1;j<=k;j++)
        {
            dp[i][j]=(sdp[i-1][j]-sdp[i-1][j-a[i]-1])%mod;
            sdp[i][j]=(sdp[i][j-1]+dp[i][j])%mod;
        }
        dp[i][0]=1;
    }
    /*for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=k;j++)cout<<dp[i][j]<<" ";
        cout<<"\n";
    }*/
    cout<<dp[n][k]%mod;
}
;j++)
        {
            dp[i][j]++;
            dp[i][j]=(dp[i][j]+sdp[i-1][j])%mod;
            sdp[i][j]=(dp[i][j]+sdp[i][j-1])%mod;
        }
        for(int j=a[i]+1;j<=k;j++)
        {
            dp[i][j]=(sdp[i-1][j]-sdp[i-1][j-a[i]-1])%mod;
            sdp[i][j]=(sdp[i][j-1]+dp[i][j])%mod;
        }
        dp[i][0]=1;
    }
    /*for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=k;j++)cout<<dp[i][j]<<" ";
        cout<<"\n";
    }*/
    cout<<dp[n][k]%mod;
}
