#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int arr[100];
long long int dp[100][100005];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, k;
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  for (long long int i = 0; i <= arr[0]; i++) dp[0][i] = 1;
  for (long long int i = 1; i < n; i++) {
    vector<long long int> prefix(k + 1);
    prefix[0] = dp[i - 1][0];
    for (long long int j = 1; j <= k; j++)
      prefix[j] = (prefix[j - 1] + dp[i - 1][j]) % mod;
    for (long long int j = 1; j <= k; j++) {
      if (j > arr[i])
        dp[i][j] = (prefix[j] + mod - prefix[j - arr[i] - 1]) % mod;
      else
        dp[i][j] = prefix[j];
    }
  }
  cout << dp[n - 1][k];
}
