#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7LL;
int N, K;
long long A[103];
long long DP[103][100003];
long long SUMDP[103][100003];
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> K;
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int i = 0; i < A[0] + 1; ++i) DP[0][i] = 1ll;
  for (int i = 0; i < N; ++i) {
    if (i == 0) continue;
    for (int j = 0; j < K + 1; ++j) {
      SUMDP[i][j] = j == 0 ? DP[i - 1][0] : SUMDP[i][j - 1] + DP[i - 1][j];
      if (j < A[i] + 1) {
        DP[i][j] = SUMDP[i][j];
        DP[i][j] %= MOD;
      } else {
        DP[i][j] = SUMDP[i][j] - SUMDP[i][j - A[i] - 1];
        DP[i][j] %= MOD;
      }
      SUMDP[i][j] %= MOD;
    }
  }
  cout << DP[N - 1][K] << "\n";
  return 0;
}
