/// Great & Inimitable Vonatlus
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type,
less<T>, rb_tree_tag, 
tree_order_statistics_node_update>;

using ll = long long;
using pii = pair<int, int>;                                   

const int N = 2e2;
const int W = 2e5;
const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

ll dp[N][W], p[N][W];

void add(ll& a, ll b) {
    a = (a % MOD + b % MOD) % MOD;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i)
        cin >> a[i];                                                                            
    dp[0][0] = 1;
    for (int w = 0; w <= k; ++w)
        p[0][w] = 1;
    for (int w = 0; w <= k; ++w)          
        for (int i = 1; i <= n; ++i) {
            add(dp[i][w], p[i - 1][w] - (w < a[i] + 1 ? 0ll : p[i - 1][w - a[i] - 1])); 
            add(p[i][w], (w ? p[i][w - 1] : 0) + dp[i][w]);
        }
    cout << dp[n][k] % MOD;
    return 0;    
}