#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 111;
const int MAX_K = 1e5 + 10;
const int MOD = 1e9 + 7;
int N, K;
long long dp[MAX_N][MAX_K], s[MAX_K];
int A[MAX_N];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int i = 0; i < A[0] + 1; ++i) dp[0][i] = 1;
  for (int i = 1; i < N; ++i) {
    s[0] = dp[i - 1][0];
    for (int j = 0; j < MAX_K; ++j) (s[j + 1] = s[j] + dp[i - 1][j + 1]) %= MOD;
    for (int j = 0; j < MAX_K; ++j) {
      (dp[i][j] += s[j]) %= MOD;
      if (j > A[i]) (dp[i][j] -= s[j - A[i] - 1]) %= MOD;
    }
  }
  cout << dp[N - 1][K] << endl;
}
