#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
template <typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n = 0) : n(n), d(n + 1) {}
  void add(int i, T x = 1) {
    for (i++; i <= n; i += i & -i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i & -i) {
      x += d[i];
    }
    return x;
  }
};
BIT<mint> dp[110];
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < (N); i++) cin >> a[i];
  for (int i = 0; i < (N + 1); i++) dp[i] = BIT<mint>(K + 1);
  dp[0].add(0, 1);
  for (int i = 0; i < (N); i++) {
    for (int j = 0; j < (K + 1); j++) {
      mint now = dp[i].sum(j);
      int low = j - a[i] - 1;
      if (low >= 0) now -= dp[i].sum(low);
      dp[i + 1].add(j, now);
    }
  }
  cout << (dp[N].sum(K) - dp[N].sum(K - 1)).x << endl;
}
