#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
void print() {}
template <class H, class... T>
void print(H&& h, T&&... t) {
  cout << h << " \n"[sizeof...(t) == 0];
  print(forward<T>(t)...);
}
ll dp[2][100010] = {};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  ll a[110];
  for (ll i = (0); i < (N); i++) cin >> a[i];
  dp[0][0] = 1;
  ll cur = 0, nxt = 1;
  for (ll i = (0); i < (N); i++) {
    for (ll j = (0); j < (K + 1); j++) dp[nxt][j] = 0;
    for (ll j = (K); j >= (0); j--) {
      dp[nxt][j] += dp[cur][j];
      dp[nxt][j] %= MOD;
      dp[nxt][j + a[i] + 1] = (dp[nxt][j + a[i] + 1] - dp[cur][j] + MOD) % MOD;
    }
    for (ll j = (0); j < (K + 1); j++) (dp[nxt][j + 1] += dp[nxt][j]) %= MOD;
    nxt ^= 1;
    cur ^= 1;
  }
  print(dp[cur][K]);
}
