#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
const int N = 105;
const int K = 1e5 + 5;
long long n, k, a[N], dp[K], pre[K];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  fill(pre, pre + K, 1);
  for (int i = 0; i < n; ++i) {
    for (int j = k; j >= 0; --j)
      dp[j] = (pre[j] - (j - a[i] - 1 >= 0 ? pre[j - a[i] - 1] : 0)) % MOD;
    pre[0] = dp[0];
    for (int j = 1; j <= k; ++j) pre[j] = (pre[j - 1] + dp[j]) % MOD;
  }
  cout << dp[k] << "\n";
}
