#include <bits/stdc++.h>
#pragma GCC optimize("O4")
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll fpow(ll b, ll p) {
  b %= (ll)(1e9 + 7);
  ll ans = 1;
  while (p > 0) {
    if (p & 1) ans = (ans * b) % (ll)(1e9 + 7);
    p /= 2;
    b = (b * b) % (ll)(1e9 + 7);
  }
  return ans;
}
ll dp[110][100010];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  vector<ll> v(n);
  for (auto &i : v) cin >> i;
  memset(dp, sizeof(dp), 0);
  for (ll i = 0; i <= n; i++) dp[i][0] = 1;
  for (ll i = 1; i <= n; i++)
    for (ll j = 1; j <= k; j++) {
      dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
      if (j > v[i - 1]) dp[i][j] -= dp[i - 1][j - v[i - 1] - 1];
      dp[i][j] %= (ll)(1e9 + 7);
    }
  cout << dp[n][k] << "\n";
  return 0;
}
