#include <bits/stdc++.h>
using namespace std;
long long int dp[100005][101];
long long int DP[100005][101];
const long long int mod = 1e9 + 7;
int main() {
  int N, K;
  cin >> N >> K;
  int i, j;
  int a[N];
  for (i = 0; i < N; i++) cin >> a[i];
  for (i = 0; i < N; i++) {
    dp[0][i] = 1;
    DP[1][i] = 1;
  }
  for (i = 1; i < K + 1; i++) {
    if (i <= a[0]) dp[i][0] = 1;
    DP[i + 1][0] = dp[i][0] + DP[i][0];
  }
  for (i = 1; i < K + 1; i++) {
    for (j = 1; j < N; j++) {
      dp[i][j] = (DP[i + 1][j - 1] - DP[max(0, i - a[j] - 1)][j - 1]) % mod;
      DP[i + 1][j] = (dp[i][j] + DP[i][j]) % mod;
    }
  }
  cout << dp[K][N - 1] << endl;
}
