#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,
		tree_order_statistics_node_update> ordered_set;

long long mem[100005][105];
bool vis[100005][105];
long long arr[105];
int n , k;
const long mod = 1e9 + 7;
long long sol(long long rem , int idx){
	if(rem==0)
		return 1;
	if(rem < 0 || idx == n)
		return 0;
	if(vis[rem][idx])
		return mem[rem][idx];
	long long ret = (((sol(rem-1,idx)%mod)+(sol(rem,idx+1)%mod) - sol(rem-arr[idx]-1,idx+1)%mod)+mod)%mod;
	return mem[rem][idx] = ret;
}
int main(){
	cin>>n>>k;
	for(int i = 0; i < n ; i++)
		cin>>arr[i];
	cout<<sol(k,0);
	return 0;
}
