#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ull unsigned long long 
const ll mod = 1e9 + 7;
int main()
{
  ll n,k;
  cin>>n>>k;
  ll dp[n+1][k+1];
  memset(dp,0,sizeof(dp));
  ll arr[n+1];
  for(int i=1;i<=n;++i)
  cin>>arr[i];
  dp[0][0]=1;
  for(int i=1;i<=n;++i)
  {
    ll pre=0;
    for(int j=0;j<=k;++j)
    {
      pre += dp[i-1][j];
      if(j-arr[i]-1>=0) pre -= dp[i-1][j-arr[i]-1];
      pre = (pre + mod)%mod;
      dp[i][j] = pre;
    }
  }
  cout<<dp[n][k];
}