#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream& operator<<(ostream& out, const pair<A, B>& p) {
  return out << "(" << p.first << ", " << p.second << ")";
}
template <class A>
ostream& operator<<(ostream& out, const vector<A>& v) {
  out << "[";
  for (long long i = 0; i < v.size(); i++) {
    if (i) out << ", ";
    out << v[i];
  }
  return out << "]";
}
template <class A, class B>
ostream& operator<<(ostream& out, const set<A, B>& s) {
  out << "[";
  for (auto i = s.begin(); i != s.end(); i++) {
    out << ", ";
    out << *i;
  }
  return out << "]";
}
template <class A>
ostream& operator<<(ostream& out, const set<A>& s) {
  out << "[";
  for (auto i = s.begin(); i != s.end(); i++) {
    out << ", ";
    out << *i;
  }
  return out << "]";
}
const long long mod = 1e9 + 7;
const long long N = 110;
const long long K = 1e5 + 10;
long long dp[N][K];
long long sum[N][K];
int32_t main() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  long long a[n];
  for (long long i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (long long i = 1; i < K; i++) sum[0][i] = 1;
  long long tot = 0;
  for (long long i = 1; i <= n; i++) {
    tot += a[i];
    for (long long j = 0; j <= k; j++) {
      dp[i][j] += sum[i - 1][j + 1] - sum[i - 1][j - min(a[i], j)];
      dp[i][j] %= mod;
      sum[i][j + 1] = sum[i][j] + dp[i][j];
      sum[i][j + 1] %= mod;
    }
  }
  cout << ((dp[n][k] % mod) + mod) % mod;
}
