#include <bits/stdc++.h>
using namespace std;
const long long N = 105, M = 1e5 + 5, MOD = 1e9 + 7;
long long n, k, A[N], dp[N][M], sm[N];
int32_t main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> A[i];
    sm[i] = sm[i - 1] + A[i];
  }
  for (long long i = 0; i <= A[1]; i++) dp[1][i] = 1;
  for (long long i = 2; i <= n; i++) {
    dp[i][0] = 1;
    for (long long j = 1; j <= min(k, sm[i]); j++) {
      if (j - A[i] > 0)
        dp[i][j] = (dp[i][j - 1] - dp[i - 1][j - A[i] - 1] + MOD) % MOD;
      else
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
    }
  }
  cout << dp[n][k] << "\n";
}
