#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
#define a_macro(args...) sum(args)
#define mp make_pair
#define eb emplace_back
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

typedef long long ll;
const ll mod = 1e9+7;

typedef tuple<int,int,int> State; // operator< defined
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef double ld;


int main(int argc, const char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  
	int n,k,i,j,l;
	cin>>n>>k;
	int a[n];
	for(i=0;i<n;++i)
		cin>>a[i];

	int dp[n+1][k+1];
	memset(dp,0,sizeof(dp));
	
	dp[0][0] = 1;

    for(i=1;i<=n;++i){
    	for(j=0;j<=k;++j){
    		for(l=0;l<=a[i-1];l++)
    			if(j >= l)
    				dp[i][j] += dp[i-1][j-l] %= mod;
    	}
    }
    cout<<dp[n][k]<<"\n";

#ifndef LOCAL_DEFINE
    cerr << "Time elapsed: "<< 1e1 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif // LOCAL_DEFINE
    return 0;
}