#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int mod = 1000000007;
const int max_k = 100005;
int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<ll> dp(100005, 0);
  for (int i = 0; i < (int)(a[0] + 1); i++) dp[i] = 1;
  for (int i = 1; i < n; i++) {
    vector<ll> p(100005);
    swap(dp, p);
    dp[0] = p[0];
    for (int j = 0; j < (int)(a[i]); j++) (dp[j + 1] = dp[j] + p[j + 1]) %= mod;
    for (int j = a[i] + 1; j <= max_k; j++) {
      (dp[j] = dp[j - 1] + p[j] - p[j - a[i] - 1]) %= mod;
    }
  }
  cout << dp[k] << endl;
  return 0;
}
