#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int A[100100];
long long DP[110][100100];
int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A[i] = a;
  }
  for (int i = 0; i <= A[0]; i++) {
    DP[0][i] = 1;
  }
  for (int i = 1; i < N; i++) {
    DP[i][0] = DP[i - 1][0];
    for (int j = 1; j <= K; j++) {
      DP[i][j] = DP[i][j - 1] + DP[i - 1][j];
      if (j - 1 - A[i] >= 0) DP[i][j] -= DP[i - 1][j - 1 - A[i]];
    }
  }
  printf("%lld\n", DP[N - 1][K] % MOD);
  return 0;
}
