#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
const int MAXK = 1e5 + 10;
const int MOD = 1e9 + 7;
long long a[MAXN];
long long dp[MAXK][MAXN];
long long pSum[MAXK][MAXN];
int main() {
  long long n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i <= a[0]; i++) dp[i][1] = 1;
  pSum[0][1] = 1;
  for (int i = 1; i < k; i++) pSum[i][1] = pSum[i - 1][1] + dp[i][1];
  for (int i = 0; i <= n; i++) dp[0][i] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= a[i - 1]; j++) {
      dp[j][i] = (dp[j - 1][i] % MOD) + (dp[j][i - 1] % MOD);
      dp[j][i] = dp[j][i] % MOD;
    }
    for (int j = a[i - 1] + 1; j <= k; j++) {
      dp[j][i] =
          (dp[a[i - 1]][i] % MOD) - (pSum[j - a[i - 1] - 1][i - 1] % MOD);
      dp[j][i] = dp[j][i] % MOD;
    }
    pSum[0][i] = dp[0][i];
    for (int j = 1; j <= k; j++) {
      pSum[j][i] = (pSum[j - 1][i] % MOD) + (dp[j][i] % MOD);
      pSum[j][i] = pSum[j][i] % MOD;
    }
  }
  cout << dp[k][n] % MOD;
  return 0;
}
