#include <bits/stdc++.h>
using namespace std;
const long long MOD_P = 1000000000 + 7;
const int MAX_N = 100 + 2;
const int MAX_K = 100000 + 2;
long long dp[MAX_N][MAX_K];
long long a[MAX_N];
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  long long maxval = 0;
  for (int j = 0; j <= K; j++) {
    if (j == 0) {
      dp[0][j] = 1;
      maxval = max(maxval, dp[0][j]);
    } else if (0 < j && j <= a[0]) {
      dp[0][j] = dp[0][j - 1] + 1;
      maxval = max(maxval, dp[0][j]);
    } else
      dp[0][j] = maxval;
    dp[0][j] %= MOD_P;
  }
  for (int i = 1; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      if (j == 0) {
        dp[i][j] = 1;
      } else {
        long long lb = j - a[i] - 1;
        long long add = dp[i - 1][j];
        if (lb >= 0) add -= dp[i - 1][lb];
        dp[i][j] = add + dp[i][j - 1];
      }
      dp[i][j] %= MOD_P;
    }
  }
  if (K > 0)
    cout << dp[N - 1][K] - dp[N - 1][K - 1] << endl;
  else
    cout << dp[N - 1][K] << endl;
  return 0;
}
