#include <bits/stdc++.h>
using namespace std;
long long dp[100][100001];
int main() {
  memset(dp, 0, sizeof(dp[0][0]) * 100 * 10001);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k, idx;
  cin >> n >> k;
  int* arr = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int j = 0; j <= k; j++) {
    if (j <= arr[n - 1])
      dp[n - 1][j] = 1;
    else
      dp[n - 1][j] = 0;
  }
  for (int j = 1; j <= k; j++) {
    dp[n - 1][j] = (dp[n - 1][j] + dp[n - 1][j - 1]) % 1000000007;
  }
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j <= k; j++) {
      idx = min(j, arr[i]);
      if ((j - idx) == 0)
        dp[i][j] = dp[i + 1][j];
      else
        dp[i][j] = (dp[i + 1][j] - dp[i + 1][j - idx - 1]) % 1000000007;
    }
    if (i != 0) {
      for (int j = 1; j <= k; j++) {
        dp[i][j] = (dp[i][j] + dp[i][j - 1]) % 1000000007;
      }
    }
  }
  cout << dp[0][k] << endl;
}
