#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1e9+7;
const int N=1e5+2;
ll dp[N][102];
ll a[106];
ll solve(ll i,ll n,ll k)
{
if(k==0)
return 1;
if(i>n)
return 0;
if(dp[k][i]!=-1)
return dp[k][i];
ll ans=0;
for(int j=0;j<=a[i];j++)
if(k>=j)
ans=(ans+solve(i+1,n,k-j))%mod;
return dp[k][i]=ans;
}
int main()
{
int n,k;
cin>>n>>k;
memset(dp,-1,sizeof(dp));
for(int i=1;i<=n;i++)
cin>>a[i];
cout<<solve(1,n,k);
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgaW50IGxsOwpsbCBtb2Q9MWU5Kzc7CmNvbnN0IGludCBOPTFlNSsyOwpsbCBkcFtOXVsxMDJdOwpsbCBhWzEwNl07CmxsIHNvbHZlKGxsIGksbGwgbixsbCBrKQp7CiAgaWYoaz09MCkKICAgIHJldHVybiAxOwogIGlmKGk+bikKICAgIHJldHVybiAwOwogIGlmKGRwW2tdW2ldIT0tMSkKICAgIHJldHVybiBkcFtrXVtpXTsKICBsbCBhbnM9MDsKICBmb3IoaW50IGo9MDtqPD1hW2ldO2orKykKICAgIGlmKGs+PWopCiAgICBhbnM9KGFucytzb2x2ZShpKzEsbixrLWopKSVtb2Q7CiAgICByZXR1cm4gZHBba11baV09YW5zOwp9CmludCBtYWluKCkKewogIGludCBuLGs7CiAgY2luPj5uPj5rOwogIG1lbXNldChkcCwtMSxzaXplb2YoZHApKTsKICBmb3IoaW50IGk9MTtpPD1uO2krKykKICAgIGNpbj4+YVtpXTsKICAgIGNvdXQ8PHNvbHZlKDEsbixrKTsKfQ==