#include <cstdio>
#include <iostream>
#define MAXN 105000
#define WTF 1000000007
using namespace std;

int n, k;
int a[MAXN];
int ans[150][MAXN];
int main(){
    cin >> n >> k;
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    for (int i = 0; i <= a[0]; i++){
        ans[0][i] = 1;
    }
    for (int i = 1; i < n; i++){
        ans[i][j] = ans[i-1][j];
        for (int j = 1; j <= a[i]; j++){
            ans[i][j] = (ans[i-1][j] + ans[i][j-1])%WTF;
        }
        for (int j = a[i]+1; j <= k; j++){
            ans[i][j] = (ans[i][j-1] + ans[i-1][j] - ans[i-1][j-a[i]-1])%WTF;
        }
    }
    /*for (int i = 0; i <= n; i++){
        for (int j = 0; j <= k; j++){
            cout << ans[i][j] << ' ';
        }
        cout << endl;
    }*/
    cout << ans[n-1][k]%WTF << endl;
}