#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using lld = long double;
const ll oo = 0x3f3f3f3f;
const ll MOD = 1000000007;
const ll N = 105;
const ll K = 300005;
ll ar[N], dp[N][K + 10];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  for (ll i = 0; i < n; i++) cin >> ar[i];
  dp[0][0] = 1;
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < K; j++) {
      if (dp[i][j] == 0) break;
      dp[i + 1][j] = (dp[i + 1][j] % MOD + dp[i][j] % MOD) % MOD;
      dp[i + 1][j + ar[i] + 1] =
          (dp[i + 1][j + ar[i] + 1] % MOD - dp[i][j] % MOD + MOD) % MOD;
    }
    for (ll j = 0; j < K; j++)
      dp[i + 1][j] =
          ((dp[i + 1][j] % MOD + dp[i + 1][j - 1] % MOD) + MOD) % MOD;
  }
  cout << dp[n][k] << '\n';
  ;
  return 0;
}
