#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e2 + 5;
const long long MAXK = 1e5 + 5;
const long long MOD = 1e9 + 7;
long long arr[MAXN];
long long dp[MAXN][MAXK];
long long sum[MAXN][MAXK];
int32_t main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  for (long long i = 0; i < n; i++) {
    dp[i][0] = 1;
    sum[i][0] = 1;
  }
  for (long long j = 0; j <= k; j++) {
    if (j <= arr[0]) dp[0][j] = 1;
    if (j)
      sum[0][j] = dp[0][j] + sum[0][j - 1];
    else
      sum[0][j] = dp[0][j];
  }
  for (long long i = 1; i < n; i++) {
    for (long long j = 1; j <= k; j++) {
      if (j - arr[i] - 1 >= 0)
        dp[i][j] = (sum[i - 1][j] - sum[i - 1][j - arr[i] - 1]) % MOD;
      else
        dp[i][j] = (sum[i - 1][j]) % MOD;
    }
    for (long long j = 0; j <= k; j++) {
      if (j)
        sum[i][j] = (dp[i][j] + sum[i][j - 1]) % MOD;
      else
        sum[i][j] = (dp[i][j]) % MOD;
    }
  }
  cout << dp[n - 1][k] << '\n';
}
