#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1e9 + 7;
long long N, K;
long long a[100];
long long dp[101][100001] = {};
signed main() {
  cin >> N >> K;
  for (long long i = 0, i_len = (N); i < i_len; ++i) cin >> a[i];
  dp[N][K] = 1;
  for (long long i = N - 1; i >= 0; --i)
    for (long long j = K; j >= 0; --j) {
      if (j + a[i] + 1 <= K)
        dp[i][j] = dp[i + 1][j] + dp[i][j + 1] - dp[i + 1][j + a[i] + 1];
      else if (j + 1 <= K)
        dp[i][j] = dp[i + 1][j] + dp[i][j + 1];
      else
        dp[i][j] = dp[i + 1][j];
      dp[i][j] %= mod;
    }
  cout << dp[0][0] << endl;
}
