#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for( int i=0;i<N; ++i )
    cin >> a[i];
  vector< vector<ll> > dp(N+1, vector<ll>(K+1));

  dp[0][0] = 1;
  for( int i=0;i<N; ++i )
    {
      int cumsum = 0;
      for( int j=0;j<K+1;++j )
	{
	  cumsum = (cumsum+dp[i][j])%1000000007;
	  dp[i+1][j] = cumsum;
	  if( j>a[i]-1 )
	    cumsum = (1000000007+cumsum-dp[i][j-a[i]])%1000000007;
	}
    }
  cout << dp[N][K] << endl;
  
}
