#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;
template <class T>
struct SegmentTree {
  using func = function<T(T, T)>;

 private:
  int n;
  T ie;
  func operation;
  func updater;
  vector<T> node;
  T _query(int l, int r, int k, int kl, int kr) {
    if (kr <= l || r <= kl) return ie;
    if (l <= kl && kr <= r) return node[k];
    T v1 = _query(l, r, 2 * k + 1, kl, (kl + kr) / 2);
    T v2 = _query(l, r, 2 * k + 2, (kl + kr) / 2, kr);
    return operation(v1, v2);
  }

 public:
  void init(int _n, T _ie, func _operation, func _updater) {
    n = 1;
    while (n < _n) n *= 2;
    ie = _ie;
    operation = _operation;
    updater = _updater;
    node.assign(2 * n - 1, ie);
  }
  void update(int i, T x) {
    i += n - 1;
    node[i] = updater(node[i], x);
    while (i > 0) {
      i = (i - 1) / 2;
      node[i] = operation(node[2 * i + 1], node[2 * i + 2]);
    }
  }
  T query(int l, int r) { return _query(l, r, 0, 0, n); }
};
ll n, k;
ll a[N];
SegmentTree<ll> dp[N];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  auto add = [](ll a, ll b) { return (a + b) % MOD; };
  auto change = [](ll a, ll b) { return b; };
  for (int i = 0; i <= n; i++) dp[i].init(K, 0LL, add, change);
  for (int ch = 1; ch <= n; ch++) {
    for (int ca = 0; ca <= k; ca++) {
      if (ch == 1) dp[ch].update(ca, a[ch] >= ca);
      if (ca == 0) dp[ch].update(ca, 1);
    }
  }
  for (int ch = 2; ch <= n; ch++) {
    for (int ca = 1; ca <= k; ca++) {
      dp[ch].update(ca, dp[ch - 1].query(ca - a[ch], ca + 1));
    }
  }
  cout << dp[n].query(k, k + 1) << endl;
}
