#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll N = 1e2 + 9;
const ll K = 1e5 + 9;
const ll MOD = 1e9 + 7;
ll mod(ll n) {
  n %= MOD;
  if (n < 0) n += MOD;
  return n;
}
ll addmod(ll &a, ll b) { return a = mod(mod(a) + mod(b)); }
struct BIT {
  vector<ll> bit;
  int n;
  void init(int _n) {
    n = _n;
    bit.assign(n + 1, 0);
  }
  void add(int i, ll x) {
    i++;
    while (i <= n) addmod(bit[i], x), i += i & -i;
  }
  int sum(int i) {
    ll res = 0;
    while (i > 0) addmod(res, bit[i]), i -= i & -i;
    return res;
  }
};
ll n, k;
ll a[N];
BIT dp[N];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i < N; i++) dp[i].init(K);
  for (int ch = 1; ch <= n; ch++) {
    for (int ca = 0; ca <= k; ca++) {
      if (ch == 1)
        dp[ch].add(ca, a[ch] >= ca);
      else if (ca == 0)
        dp[ch].add(ca, 1);
    }
  }
  for (int ch = 2; ch <= n; ch++) {
    for (int ca = 1; ca <= k; ca++) {
      dp[ch].add(ca, dp[ch - 1].sum(ca + 1) - dp[ch - 1].sum(ca - a[ch]));
    }
  }
  cout << dp[n].sum(k + 1) - dp[n].sum(k) << endl;
}
