#include <bits/stdc++.h>
using namespace std;
int dp[100005][105], prefix[100005][105];
int n, k;
int arr[105];
const int MOD = 1e9 + 7;
int main() {
  cin >> n >> k;
  for (int i = 0; i < 100005; i++)
    for (int j = 0; j < 105; j++) dp[i][j] = 0;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 0; i < 100005; i++) dp[i][0] = prefix[i][0] = 1;
  for (int i = 0; i < 105; i++) prefix[0][i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= k; j++) {
      int first = (j - arr[i] - 1 >= 0) ? prefix[i - 1][j - arr[i] - 1] : 0;
      int last = prefix[i - 1][j];
      dp[i][j] = (dp[i][j] + MOD + last - first) % MOD;
      prefix[i][j] = (prefix[i][j - 1] + dp[i][j]) % MOD;
    }
  cout << dp[n][k];
}
