#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e2 + 10, maxk = 1e5 + 10, mod = 1e9 + 7;
long long dp[maxn][maxk], n, k, a[maxn], sum[maxn][maxk];
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  sum[0][0] = 1;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i <= k; i++) {
    if (i <= a[0])
      dp[0][i] = 1;
    else
      dp[0][i] = 0;
    sum[0][i] = dp[0][i] + sum[0][i - 1];
  }
  for (long long i = 1; i < n; i++) {
    sum[i][0] = 1;
    dp[i][0] = 1;
    for (long long j = 1; j <= k; j++) {
      if (j - 1 - a[i] >= 0)
        dp[i][j] = (sum[i - 1][j] - sum[i - 1][j - 1 - a[i]] + mod) % mod;
      else
        dp[i][j] = sum[i - 1][j];
      sum[i][j] = (sum[i][j - 1] + dp[i][j]) % mod;
    }
  }
  cout << dp[n - 1][k];
}
