#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int fastexpo(long long int x, long long int y) {
  long long int a = 1;
  while (y > 0) {
    if (y & 1) a = (a * x) % mod;
    y /= 2;
    x = (x * x) % mod;
  }
  return a;
}
long long int dp[103][100005];
long long int a[103];
int n;
int main() {
  ios::sync_with_stdio(false);
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) dp[i][0] = 1;
  for (int i = 1; i <= a[0]; i++) dp[0][i] = 1;
  for (int i = 1; i <= k; i++) dp[0][i] = (dp[0][i - 1] + dp[0][i]) % mod;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      int lim = min(long long int(j), a[i]);
      if (lim == j)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = dp[i - 1][j] - dp[i - 1][j - lim - 1];
    }
    for (int j = 1; j <= k; j++) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
  }
  if (k = 0)
    cout << dp[n - 1][k] << endl;
  else
    cout << dp[n - 1][k] - dp[n - 1][k - 1] << endl;
  return 0;
}
