#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 6;
const int MOD = 1e9 + 7;
const long long LLINF = 1LL << 60;
const int MAX_N = 101, MAX_K = 1e5 + 1;
long long dp[MAX_N][MAX_K];
int main() {
  int N, K;
  cin >> N >> K;
  long long a[N];
  for (int i = 0; i < (int)(N); i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i < (int)(N); i++) {
    for (int j = 0; j <= K; ++j) {
      if (a[i] >= j) {
        if (j - 1 >= 0)
          dp[i + 1][j] = (dp[i + 1][j - 1] + dp[i][j]) % MOD;
        else
          dp[i + 1][j] = dp[i][j];
      } else if (a[i] < j) {
        dp[i + 1][j] =
            (dp[i + 1][j - 1] + dp[i][j] - dp[i][j - a[i] - 1]) % MOD;
      }
    }
  }
  cout << dp[N][K] << endl;
}
