#include <bits/stdc++.h>
using namespace std;
int N, K;
const int MOD = 1e9 + 7;
int DP[101][100001], prefix[101][100001];
int A[101];
int solve() {
  for (int i = 0; i <= N; i++) DP[i][0] = prefix[i][0] = 1;
  for (int i = 1; i <= K; i++) prefix[0][i] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= K; j++) {
      int first = 0;
      if (j > A[i]) {
        first = prefix[i - 1][j - A[i] - 1];
      }
      int last = prefix[i - 1][j];
      DP[i][j] = (last - first) % MOD;
      prefix[i][j] = (DP[i][j] + prefix[i][j - 1]) % MOD;
    }
  }
  return DP[N][K];
}
int main() {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  cout << solve() << "\n";
  return 0;
}
