//In the name of Allah
//In the name of the compassionate of the merciful
//Ya Ali!
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename Type>
using ordered_multiset = tree<Type, null_type, less_equal<Type>, rb_tree_tag, tree_order_statistics_node_update> ;

typedef long long ll ;
typedef long double ld ;

const ll maxn = 1e5 + 10 ;
const ll INF = 3e18 ;

#define f first
#define s second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define endll "\n"
#define sortt(v) sort(v.begin() , v.end())
#define reversee(v) reverse(v.begin() , v.end())

// for sqrt on interval and array , always sq = maxn/80 ;
// cout << *ss.find_by_order(index) ; -> return the value that indexed in index position
// cout << ss.order_of_key(value) ; -> lower_bound in ordered_set
//ifstream fin("input.txt");
//ofstream fout("output.txt");
// fflush(stdout);
ll mod = 1e9 + 7 , p1 = 999999929 , p2 = 999999937 ;

ll n , a[maxn] , dp[110][maxn] , sum[110][maxn] , k ;

int main()
{
std::ios::sync_with_stdio(0) ;
cin.tie(0) ;
cout.tie(0) ;

cin >> n >> k ;
for(int i = 1 ; i <= n ; i ++)cin >> a[i] ;

sum[1][-1] = 0 ;
for(ll i = 0; i <= k ; i ++){
   if(i <= a[1])dp[1][i] = 1;
   else dp[1][i] = 0 ;
   sum[1][i] = (sum[1][i-1]+dp[1][i])%mod ;
}

//cout << dp[1][k] << endl ;

for(int i = 2 ; i <= n ; i ++){
    sum[i][-1] = 0 ;
    for(int j = 0 ; j <= k ; j ++){
        dp[i][j] = (sum[i-1][j] - sum[i-1][max(0ll , j-a[i])-1])%mod ;
        sum[i][j] = (sum[i][j-1] + dp[i][j])%mod ;
    }
}
cout << dp[n][k] ;
 return 0;
}
/*
                  _     _   __
            /_\  (_    (_)  __)
           /   \  _) . (_) (__
*/
