#include <bits/stdc++.h>
using namespace std;
int n;
int arr[101];
const int MOD = (int)1e9 + 7;
int main() {
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long long dp[n][k + 1];
  for (int i = 0; i <= k; ++i) {
    dp[n - 1][i] = 0;
    if (i <= arr[n - 1]) dp[n - 1][i] = 1;
  }
  for (int i = 1; i <= k; ++i) {
    dp[n - 1][i] += dp[n - 1][i - 1];
    dp[n - 1][i] %= MOD;
  }
  for (int i = n - 2; i >= 0; --i) {
    for (int j = 0; j <= k; ++j) {
      dp[i][j] = 0;
      dp[i][j] =
          dp[i + 1][j] - ((j - arr[i] > 0) ? dp[i + 1][j - arr[i] - 1] : 0);
      if (j and i) {
        dp[i][j] += dp[i][j - 1];
      }
      dp[i][j] %= MOD;
    }
  }
  cout << (dp[0][k] + MOD) % MOD;
}
