#include <iostream>
using namespace std;
 
#define MAXN 120
#define MAXK 100020
#define MOD 1000000007
 
int N,K;
long long dp[MAXN][MAXK];
long long a[MAXN];
 
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];
  
  for (int i = 0; i <= a[0]; i++) dp[0][i] = 1;
  
  for (int i = 1; i < N; i++) {
    dp[i][0] = dp[i-1][0];
    for (int j = 1; j <= a[i]; j++) {
      dp[i][j] = (dp[i][j-1] + dp[i-1][j])%MOD;
    }
    for (int j = a[i]+1; j <= K; j++) {
      dp[i][j] = (dp[i][j-1] + dp[i-1][j])%MOD;
      dp[i][j] -= (dp[i][j-a[i]-1]);
      dp[i][j]%=MOD;
      if (dp[i][j] < 0) dp[i][j] += MOD;
    }
    
      
      
  cout << dp[N-1][K] << endl;
}