#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll MOD = 1e9+7;
ll A[101000];ll n,k;ll B[110][101000];
int main(){
      cin>>n>>k;ll a;
      for(ll j=0;j<=k;j++){
            B[0][j] = 0;
      }
      B[0][0] = 1;
      A[0] = 0;
      for(ll i=1;i<=n;i++){
            cin>>a;
            for(ll j=0;j<=k;j++){
                  A[j+1] = (A[j]+B[i-1][j])%MOD;
            }
            for(ll j=0;j<=k;j++){
                  B[i][j] = (A[j+1]-A[max(0LL,j-a)]+MOD)%MOD;
            }
      }
      cout<<B[n][k]<<endl;
      return 0;
}
