// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const int N = 1e5 + 2;

int dp[102][N], pre[102][N];

void solve() {
   int n, k; cin >> n >> k;
   
   int data[n+5];
   for(int i = 1; i <= n; i++) cin >> data[i];
   
   for(int i = 1; i <= k; i++) pre[0][i] = 1;

   for(int i = 1; i <= n; i++) {
       dp[i][0] = 1; pre[i][0] = 1;
       for(int j = 1; j <= k; j++) {
         dp[i][j] = (pre[i-1][j] - pre[i-1][max(0ll, j-data[i]-1)] + mod) % mod;
         dp[i][j] %= mod;
         pre[i][j] += pre[i][j-1];
         pre[i][j] += dp[i][j];
         pre[i][j] %= mod;
       }
       pre[i][0] = 0;
    }
   cout << dp[n][k] << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt", "w", stdout);
    // #endif
    int t = 1; // cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
}    
