#include <bits/stdc++.h>
using namespace std;
long long int dp[2][100005];
long long int sum[100005];
int arr[110];
long long int mod = 1e9 + 7;
void solve() {
  int i, j, n, k;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (i = 1; i <= n; i++) {
    dp[i % 2][0] = 1;
    sum[0] = dp[(i + 1) % 2][0];
    for (j = 1; j <= k; j++) {
      sum[j] = (sum[j - 1] + dp[(i + 1) % 2][j]) % mod;
    }
    for (j = 1; j <= k; j++) {
      if (j <= arr[i - 1]) {
        dp[i % 2][j] = sum[j];
      } else {
        dp[i % 2][j] = (sum[j] - sum[j - arr[i - 1] - 1]) % mod;
      }
    }
  }
  cout << dp[n % 2][k] << endl;
}
int main() {
  solve();
  return 0;
}
