#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

const int MAX_N = 200010;
long long N,K;
long long pref[MAX_N];
long long currpref[MAX_N];
long long dp[210][MAX_N];
long long a[MAX_N];

int add(int a, int b) {
    a += b;
    if(a >= MOD) {
        a -= MOD;
    }
    return a;
}
int sub(int a, int b) {
    a -= b;
    if(a < 0) {
        a += MOD;
    }
    return a;
}
void add_self(int& a, int b) {
    a = add(a, b);
}
void sub_self(int& a, int b) {
    a = sub(a, b);
}

int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> K;
    for (long long i = 1; i<=N; i++) {
        cin >> a[i];
        a[i];
    }
    dp[0][0] = 1;
    for (long long i = 0; i<=K; i++) {
        // pref[i+1]=(pref[i+1]+pref[i])%MOD;
        add_self(pref[i+1], pref[i]);
        // pref[i+1]=(pref[i+1]+dp[0][i])%MOD;
        add_self(pref[i+1], dp[0][i]);
    }
    for (long long i = 1; i<=N; i++) {
        for (long long j = 0; j<=K; j++) {
            dp[i][j] = sub(pref[j+1], pref[max((long long)0, j-a[i])]);
            // dp[i][j] = (pref[j+1]-pref[max((long long)0, j-a[i])]+MOD)%MOD;
            add_self(currpref[j+1], currepref[j]);
            // currpref[j+1] = (currpref[j+1]+currpref[j])%MOD;
            // currpref[j+1] = (currpref[j+1]+dp[i][j])%MOD;
            add_self(currpref[j+1], dp[i][j]);
        }
        for (int j = 0; j<=K+1; j++) {
            pref[j] = currpref[j];
            currpref[j] = 0;
        }
    }
    cout << dp[N][K] << endl;
    return 0;
}
