#include <bits/stdc++.h>
using namespace std;
long long MOD = (long long)1000000000 + 7;
const long long INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
const long long MAX = 200020;
long long dp[101][100010], cum[101][100010];
long long a[100010];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  dp[0][0] = 1;
  long long N, K;
  cin >> N >> K;
  for (long long i = 0; i < N; i++) {
    cin >> a[i];
    cum[i][1] = 1;
    dp[i][0] = 1;
  }
  dp[N][0] = 1;
  for (long long i = 0; i < K + 1; i++) {
    cum[0][i + 1] = 1;
  }
  for (long long i = 1; i < N + 1; i++) {
    for (long long j = 1; j < K + 1; j++) {
      long long r = min(a[i - 1], j) + 1;
      long long l = j - min(j, a[i - 1]);
      dp[i][j] = cum[i - 1][r] - cum[i - 1][l] + MOD;
      dp[i][j] %= MOD;
    }
    for (long long j = 0; j < K + 1; j++) {
      cum[i][j + 1] = cum[i][j] + dp[i][j];
      cum[i][j + 1] %= MOD;
    }
  }
  cout << dp[N][K] % MOD << endl;
  ;
}
