#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define inf 9e18
#define pii pair<int,int>
#define ALL(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);
using namespace std;
int n,K;
int dp[101][100005];
int md = 1000000007;
int ways(int i,int k){
    if(i==n){
        if(k==0)
            return 1;
        return 0;
    }
    if(dp[i][k]!=-1)
        return dp[i][k];
    int cur_ways = 0;
    for(int j=0;j<=min(k,a[i]);j++)
        cur_ways = (cur_ways + ways(i+1,k-j))%md;
    return dp[i][k] = cur_ways;
}
int32_t main()
{
    
    fastio
  

   
    cin>>n>>K;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    for(int i=0;i<n;i++)
        for(int j=0;j<=K;j++)
            dp[i][j] = -1;
    cout<<ways(0,K);
    
    return 0;
}