#include <bits/stdc++.h>
using namespace std;
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const pair<_KTy, _Ty>& m) {
  o << "{" << m.first << ", " << m.second << "}";
  return o;
}
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const map<_KTy, _Ty>& m) {
  if (m.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *m.begin();
  for (auto itr = ++m.begin(); itr != m.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const unordered_map<_KTy, _Ty>& m) {
  if (m.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *m.begin();
  for (auto itr = ++m.begin(); itr != m.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const vector<_Ty>& v) {
  if (v.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << v.front();
  for (auto itr = ++v.begin(); itr != v.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const set<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *(s.begin());
  for (auto itr = ++s.begin(); itr != s.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const unordered_set<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *(s.begin());
  for (auto itr = ++s.begin(); itr != s.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const stack<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  stack<_Ty> t(s);
  o << "{" << t.top();
  t.pop();
  while (!t.empty()) {
    o << ", " << t.top();
    t.pop();
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const list<_Ty>& l) {
  if (l.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << l.front();
  for (auto itr = ++l.begin(); itr != l.end(); ++itr) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _KTy, typename _Ty>
istream& operator>>(istream& is, pair<_KTy, _Ty>& m) {
  is >> m.first >> m.second;
  return is;
}
template <typename _Ty>
istream& operator>>(istream& is, vector<_Ty>& v) {
  for (size_t i = 0; i < v.size(); i++) is >> v[i];
  return is;
}
namespace aux {
template <typename Ty, unsigned N, unsigned L>
struct tp {
  static void print(ostream& os, const Ty& v) {
    os << get<N>(v) << ", ";
    tp<Ty, N + 1, L>::print(os, v);
  }
};
template <typename Ty, unsigned N>
struct tp<Ty, N, N> {
  static void print(ostream& os, const Ty& v) { os << get<N>(v); }
};
}  // namespace aux
template <typename... Tys>
ostream& operator<<(ostream& os, const tuple<Tys...>& t) {
  os << "{";
  aux::tp<tuple<Tys...>, 0, sizeof...(Tys) - 1>::print(os, t);
  os << "}";
  return os;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T& val) {
  std::fill((T*)array, (T*)(array + N), val);
}
void dump_func() { cerr << endl; }
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
  cerr << head;
  if (sizeof...(Tail) == 0) {
    cerr << " ";
  } else {
    cerr << ", ";
  }
  dump_func(std::move(tail)...);
}
const long long MOD = 1000000007;
long long N, K;
vector<long long> a;
long long dp[128][101010];
long long cdp[128][101010];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> K;
  a = vector<long long>(N + 1, 0);
  for (long long i = 1; i <= N; i++) cin >> a[i];
  long long asum = accumulate((a).begin(), (a).end(), 0LL);
  if (asum < K) {
    cout << 0 << endl;
    return 0;
  }
  dp[0][0] = cdp[0][0] = 1;
  for (long long i = 1; i <= K; i++) cdp[0][i] += cdp[0][i - 1];
  for (long long i = 1; i <= N; i++) {
    for (long long k = 0; k <= K; k++) {
      dp[i][k] =
          (cdp[i - 1][k] - (k - a[i] > 0 ? cdp[i - 1][k - a[i] - 1] : 0)) % MOD;
      cdp[i][k] = (cdp[i][k - 1] + dp[i][k]) % MOD;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
