#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
const int maxk = 100010;
const long long int mod = 1000000007;
long long int dp[maxn][maxk];
long long int sums[maxn][maxk];
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  sums[0][0] = 1;
  for (long long int i = 1; i <= k; i++) {
    if (i <= a[0]) {
      dp[0][i] = 1;
      sums[0][i] = sums[0][i - 1] + 1;
    } else {
      dp[0][i] = 0;
      sums[0][i] = sums[0][i - 1];
    }
  }
  for (long long int i = 0; i <= n; i++) {
    dp[i][0] = 1;
    sums[i][0] = 1;
  }
  for (long long int i = 1; i < n; i++) {
    for (long long int j = 1; j <= k; j++) {
      if (j > a[i]) {
        dp[i][j] = (sums[i - 1][j] - sums[i - 1][j - a[i] - 1]) % mod;
      } else {
        dp[i][j] = sums[i - 1][j];
      }
      sums[i][j] = (sums[i][j - 1] + dp[i][j]) % mod;
    }
  }
  cout << dp[n - 1][k] << endl;
  return 0;
}
