#include <bits/stdc++.h>
using namespace std;
static const long long INF = 1e18;
static const long long MAX = 101010;
static const long long MOD = 1e9 + 7;
static const long long LOGN = 55;
long long dp[101][101010];
long long sum[101][101010];
int main(void) {
  long long N, K;
  cin >> N >> K;
  long long a[101];
  long long i, j;
  for (i = 0; i < N; i++) cin >> a[i];
  dp[0][0] = 1;
  sum[0][0] = 0;
  for (i = 1; i <= K; i++) sum[0][i] = 1;
  for (i = 1; i <= N; i++) {
    for (j = 0; j <= K; j++) {
      dp[i][j] = sum[i - 1][j + 1] - sum[i - 1][max(0LL, j - a[i - 1])] + MOD;
      dp[i][j] %= MOD;
      sum[i][j + 1] += sum[i][j] + dp[i][j];
      sum[i][j + 1] %= MOD;
    }
  }
  cout << dp[N][K] << "\n";
}
