#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll infll = 1LL * INT_MAX * INT_MAX;
const long double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
auto clk = clock();
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
ll rng(ll lim) {
  uniform_int_distribution<ll> uid(0, lim - 1);
  return uid(rang);
}
ld max(ld a, ld b) { return (a > b ? a : b); }
ld min(ld a, ld b) { return (a > b ? b : a); }
ll max(ll a, ll b) { return (a > b ? a : b); }
ll min(ll a, ll b) { return (a > b ? b : a); }
ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); }
ll gcd(ll a, ll b, ll &x, ll &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  ll x1, y1;
  ll d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
ll modinv(ll a, ll b) {
  ll x, y;
  gcd(a, b, x, y);
  return (x % b + b) % b;
}
ll bexp(ll a, ll b, ll m) {
  a %= m;
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % m;
    b >>= 1;
    a = a * a % m;
  }
  return res;
}
vector<vector<ll> > mat_mul(vector<vector<ll> > mat1, vector<vector<ll> > mat2,
                            ll mod1) {
  vector<vector<ll> > res(ll((mat1).size()),
                          vector<ll>(ll((mat2[0]).size()), 0));
  for (ll i = 0; i <= ll((mat1).size()) - 1; i++) {
    for (ll j = 0; j <= ll((mat2[0]).size()) - 1; j++) {
      for (ll k = 0; k <= ll((mat1[0]).size()) - 1; k++) {
        res[i][j] = (res[i][j] + (mat1[i][k] * mat2[k][j]) % mod1) % mod1;
      }
    }
  }
  return res;
}
vector<vector<ll> > mat_exp(vector<vector<ll> > mat, ll p, ll mod1) {
  vector<vector<ll> > res(ll((mat).size()), vector<ll>(ll((mat[0]).size()), 0));
  for (ll i = 0; i <= ll((mat).size()) - 1; i++) res[i][i] = 1;
  while (p > 0) {
    if (p & 1) res = mat_mul(res, mat, mod1);
    mat = mat_mul(mat, mat, mod1);
    p >>= 1;
  }
  return res;
}
void sieve(vector<int> &pr, int N) {
  int lp[N + 1];
  for (int i = 2; i <= N; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
      lp[i * pr[j]] = pr[j];
  }
}
const int N = 1e5 + 5;
ll n, m, t, q, p, g, k, x, y, u, v, z, w, l, h, r, ans;
ll dp[N];
ll a[N];
void solve() {
  cin >> n >> k;
  for (ll i = 0; i < n; i++) cin >> a[i];
  dp[0] = 1;
  for (ll i = 0; i <= n - 1; i++) {
    for (ll j = 1; j <= k; j++) {
      dp[j] = (dp[j - 1] + dp[j]) % (ll)1000000007;
    }
    for (ll j = k; j >= 0; j--) {
      if (j - a[i] - 1 >= 0)
        dp[j] = (-dp[j - a[i] - 1] + dp[j]) % (ll)1000000007;
    }
  }
  cout << dp[k] << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(16);
  ;
  t = 1;
  while (t--) {
    solve();
  }
}
