#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1e9 + 7;
long long N, K;
long long a[100];
class mint {
 private:
  long long _num, _mod;
  mint set(long long num) {
    _num = num;
    if (_num >= 0)
      _num %= _mod;
    else
      _num += (1 - (_num + 1) / _mod) * _mod;
    return *this;
  }
  long long mpow(long long a, long long n) {
    long long ans = 1;
    while (n) {
      if (n & 1) ans *= a;
      a *= a;
      n /= 2;
    }
    return ans;
  }
  long long imod(long long n) { return mpow(n, _mod - 2); }

 public:
  mint() {
    _num = 0;
    _mod = mod;
  }
  mint(long long num) {
    _mod = mod;
    _num = (num + (1LL << 30) * mod) % mod;
  }
  mint(long long num, long long M) {
    _mod = M;
    _num = (num + (1LL << 30) * mod) % _mod;
  }
  mint(const mint &cp) {
    _num = cp._num;
    _mod = cp._mod;
  }
  mint operator=(const long long x) { return set(x); }
  mint operator+(const long long x) { return mint(_num + (x % _mod), _mod); }
  mint operator-(const long long x) { return mint(_num - (x % _mod), _mod); }
  mint operator*(const long long x) { return mint(_num * (x % _mod), _mod); }
  mint operator/(long long x) { return mint(_num * imod(x), _mod); }
  mint operator+=(const long long x) { return set(_num + (x % _mod)); }
  mint operator-=(const long long x) { return set(_num - (x % _mod)); }
  mint operator*=(const long long x) { return set(_num * (x % _mod)); }
  mint operator/=(long long x) { return set(_num * imod(x)); }
  mint operator+(const mint &x) { return mint(_num + x._num, _mod); }
  mint operator-(const mint &x) { return mint(_num - x._num, _mod); }
  mint operator*(const mint &x) { return mint(_num * x._num, _mod); }
  mint operator/(mint x) { return mint(_num * imod(x._num), _mod); }
  mint operator+=(const mint &x) { return set(_num + x._num); }
  mint operator-=(const mint &x) { return set(_num - x._num); }
  mint operator*=(const mint &x) { return set(_num * x._num); }
  mint operator/=(mint x) { return set(_num * imod(x._num)); }
  bool operator<(const mint &x) { return _num < x._num; }
  friend mint operator+(long long x, const mint &m) {
    return mint(m._num + (x % m._mod), m._mod);
  }
  friend mint operator-(long long x, const mint &m) {
    return mint(m._num - (x % m._mod), m._mod);
  }
  friend mint operator*(long long x, const mint &m) {
    return mint(m._num * (x % m._mod), m._mod);
  }
  friend mint operator/(long long x, mint m) {
    return mint(m.imod(m._num) * x, m._mod);
  }
  friend ostream &operator<<(ostream &os, mint &x) {
    os << x._num;
    return os;
  }
  friend istream &operator>>(istream &is, mint &x) {
    long long val;
    is >> val;
    x.set(val);
    return is;
  }
};
signed main() {
  cin >> N >> K;
  for (long long i = 0, i_len = (N); i < i_len; ++i) cin >> a[i];
  mint dp[101][200002] = {};
  dp[N][K] = 1;
  for (long long i = N - 1; i >= 0; --i)
    for (long long j = K; j >= 0; --j) {
      dp[i][j] = dp[i + 1][j] + dp[i][j + 1] - dp[i + 1][j + a[i] + 1];
    }
  cout << dp[0][0] << endl;
}
