#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
const int MOD = 1e9 + 7;
int n, k, dp[102][M], t[102];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  for (int i = n; i >= 0; i--) {
    for (int j = 1; j <= k + 1; j++) {
      if (i == n) {
        dp[i][j] = j == 1;
        continue;
      }
      dp[i][j] = (dp[i + 1][j] - dp[i + 1][j - min(t[i], j + 1) - 1]) % MOD;
      if (j > 1) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
    }
  }
  cout << dp[0][k + 1];
}
