#include <bits/stdc++.h>
using namespace std;
int dp[110][100100];
int main() {
  const int MOD = pow(10, 9) + 7;
  int N, K;
  cin >> N >> K;
  int a[110];
  for (int i = 0; i < N; i++) {
    cin >> a[i + 1];
  }
  for (int j = 0; j <= K; j++) {
    dp[0][j] = 0;
  }
  for (int i = 0; i <= N; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= K; j++) {
      if (j - a[i] >= 1) {
        dp[i][j] = MOD + dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - a[i] - 1];
      } else {
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
      }
      dp[i][j] %= MOD;
    }
  }
  cout << dp[N][K] << endl;
}
