#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long mod = 1e9 + 7;
long long N, K;
vector<long long> v;
long long memo[109][100009];
bool vis[109][100009];
long long sol(int pos, int p) {
  if (p < 0) return 0;
  if (p == 0) return 1;
  if (pos == N) return 0;
  long long t = 0;
  if (vis[pos][p]) return memo[pos][p];
  vis[pos][p] = 1;
  for (int i = 0; i <= v[pos]; i++) {
    t += sol(pos + 1, p - i);
  }
  return memo[pos][p] =
             (sol(pos + 1, p) + sol(pos, p - 1) - sol(pos + 1, p - 1) + mod) %
             mod;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> K;
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    v.push_back(a);
  }
  for (int i = 0; i <= K; i++) memo[N][i] = 1;
  for (int i = N - 1; i >= 0; i--) {
    for (int j = 0; j <= K; j++) {
      long long f = 0;
      if (j - v[i] > 0) f = memo[i + 1][j - v[i] - 1];
      memo[i][j] = memo[i + 1][j] - f;
      if (j > 0) memo[i][j] += memo[i][j - 1];
      memo[i][j] %= mod;
    }
  }
  cout << memo[0][K] - (K > 0 ? memo[0][K - 1] : 0);
  return 0;
}
