#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
constexpr int inf = 0x3f3f3f3f;
constexpr int MAXN = 110;
constexpr int MAXK = 1e5 + 10;
constexpr int mod = 1000000007;
int main() {
  int n, K;
  scanf("%d %d", &n, &K);
  vi a(n + 1);
  for (int i = (1); i < (n + 1); i++) scanf("%d", &a[i]);
  vector<ll> dp(K + 1), new_dp(K + 1), pref(K + 1, 1);
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= K; j++) {
      new_dp[j] = pref[j];
      if (j - a[i] - 1 >= 0) new_dp[j] -= pref[j - a[i] - 1];
    }
    swap(new_dp, dp);
    pref[0] = dp[0];
    for (int j = (1); j < (K + 1); j++)
      pref[j] = (1ll * pref[j - 1] + dp[j] >= mod) ? pref[j - 1] - mod + dp[j]
                                                   : pref[j - 1] + dp[j];
  }
  if (dp[K] < 0) dp[K] += mod;
  printf("%lld\n", dp[K]);
}
