#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define stdi(in) freopen(in, "r", stdin)
#define stdo(out) freopen(out, "w", stdout)
#define stdio(in, out) stdi(in); stdo(out)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define MAX 100007
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<pair<int, int> , null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update>

//const ll modd = 998244353;
const ll inf = 1e18;

int n,k;
ll arr[102];
ll dp[MAX][102];

ll solve(int i, int candies){
    if(candies>k) return 0;
    if(candies==k){
        //cerr<<"i == "<<i<<", candies == "<<candies<<'\n';
        return 1;
    }
    if(i>n) return 0;

    if(dp[i][candies]!=-1) return dp[i][candies];

    ll ans = 0;

    for(int j=0; j<=arr[i]; j++){
        ans = (ans+solve(i+1, candies+j))%MOD;
    }

    return dp[i][candies] = ans;
}

int main(){
	/*#ifndef ONLINE_JUDGE
        stdio("in", "out");
    #endif*/
    fast;
    cin>>n>>k;
    memset(dp, -1, sizeof(dp));
    for(int i = 1; i<=n; i++){
        cin>>arr[i];
    }

    ll ans = solve(1, 0);

    cout<<ans<<'\n';

	return 0;
}

