#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using i64 = int64_t;
template <class T, class U>
void init_n(vector<T>& v, size_t n, U x) {
  v = vector<T>(n, x);
}
template <class T>
void init_n(vector<T>& v, size_t n) {
  init_n(v, n, T());
}
template <class T>
void read_n(vector<T>& v, size_t n, size_t o = 0) {
  v = vector<T>(n + o);
  for (lli i = o; i < n + o; ++i) cin >> v[i];
}
template <class T>
void read_n(T a[], size_t n, size_t o = 0) {
  for (lli i = o; i < n + o; ++i) cin >> a[i];
}
template <class T>
T gabs(const T& x) {
  return max(x, -x);
}
const i64 mod = 1e9 + 7;
i64 n, k, dp[101][100001];
vector<i64> a;
int main() {
  cin >> n >> k;
  read_n(a, n, 1);
  fill(&dp[1][0], &dp[100][100000] + 1, -1);
  dp[0][0] = 1;
  for (i64 i = 1; i <= n; ++i) {
    dp[i][0] = 1;
    for (i64 c = 1; c <= k; ++c) {
      dp[i][c] = (dp[i - 1][c] + dp[i][c - 1] -
                  (c - a[i] - 1 >= 0 ? dp[i - 1][c - a[i] - 1] : 0)) %
                 mod;
    }
  }
  cout << dp[n][k] << '\n';
  return 0;
}
