#include <iostream>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

const int mod = 1000000000+7;

int main(){
    int n,k;    cin >> n >> k;
    vector<int>a(n);
    rep(i, n)   cin >> a[i];
    vector<vector<int> >dp(n+1, vector<int>(k+1));  //dp[i][j]:=子供iまでにj個分ける
    rep(i, n+1) dp[i][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= k; j++){
            dp[i][j] += dp[i-1][j];
            dp[i][j] %= mod;
            for(int l = 1; l <= a[i-1]; l++){
                if(j-l < 0) break;
                dp[i][j] += dp[i-1][j-l];
                dp[i][j] %= mod;
            }
        }
    }
    cout << dp[n][k] << endl;
}
