#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
typedef int long long int;

ll dp[110][110000],sum[110][110000];
int a[110000];

signed main(){
    int N,K;
    cin>>N>>K;
    for(int i=1;i<=N;i++) cin>>a[i];

    for(int i=0;i<110;i++){
        dp[i][0]=1;
        sum[i][0]=1;
    } 

    for(int i=0;i<110000;i++) sum[0][i]=1;

    for(int i=1;i<=N;i++){
        int x=a[i];
        for(int j=1;j<=K;j++){
            if(j-x-1<0) dp[i][j]=sum[i-1][j];
            else dp[i][j]=sum[i-1][j]-sum[i-1][j-x-1];
            dp[i][j]%=MOD;
            sum[i][j]=sum[i][j-1]+dp[i][j];
            sum[i][j]%=MOD;
        }
    }
    cout<<dp[N][K]<<endl;
}