#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const long long mod = 1e9 + 7;
long long a[maxn], b[maxn], n, k;
long long dp[int(1e5 + 5)];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  dp[0] = 1;
  for (long long i = 1; i <= n; ++i) {
    memset(b, 0, sizeof(b));
    for (long long j = k; j >= 0; --j) {
      int l = j + 1, r = min(k, j + a[i]);
      if (l <= r) {
        (b[l] += dp[j]) %= mod;
        (b[r + 1] += mod - dp[j]) %= mod;
      }
    }
    long long now = 0;
    for (long long i = 0; i <= k; ++i) {
      (now += b[i]) %= mod;
      (dp[i] += now) %= mod;
    }
  }
  cout << dp[k] << endl;
}
