#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll dp[110][100010] = {};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  ll a[110];
  for (ll i = (0); i < (N); i++) cin >> a[i];
  dp[0][0] = 1;
  for (ll i = (0); i < (N); i++) {
    for (ll j = (0); j < (K + 1); j++) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j] %= MOD;
      if (j + a[i] + 1 <= K + 1)
        dp[i + 1][j + a[i] + 1] = (dp[i][j + a[i] + 1] - dp[i][j] + MOD) % MOD;
    }
    for (ll j = (0); j < (K + 1); j++) (dp[i + 1][j + 1] += dp[i][j]) %= MOD;
  }
  cout << dp[N][K] << endl;
}
