#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int M = 1e9 + 7;
ll dp[101][101010];
ll v[101];
int n;
ll amt, amt2;
ll f(int x, ll k) {
  if (k < 0) return 0;
  if (dp[x][k]) return dp[x][k];
  if (x == n - 1) {
    if (k > v[x]) return 0;
    return 1;
  }
  ++amt;
  if (amt % (int)1e7 == 0) cout << amt << endl;
  ll r = 0;
  dp[x][k] = r;
  ++amt2;
  if (amt2 % 1000 == 0) cout << "2: " << amt << endl;
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll ok;
  cin >> n >> ok;
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = 0; i <= v[n - 1]; ++i) dp[n - 1][i] = 1;
  for (int x = n - 2; x >= 0; --x) {
    vector<int> sum;
    ll s = 0;
    for (int i = 0; i <= ok; ++i) {
      s = (s + dp[x + 1][i]) % M;
      sum.push_back(s);
    }
    for (ll k = 0; k <= ok; ++k) {
      if (k - v[x] > 0)
        dp[x][k] = sum[k] - sum[k - v[x] - 1];
      else
        dp[x][k] = sum[k];
    }
  }
  cout << dp[0][ok] << '\n';
}
