#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 128;
const long long MAXK = 100000 + 100;
const long long MOD = 1e9 + 7;
long long a[MAXN], dp[MAXN][MAXK], sum[MAXN][MAXK];
long long n, k;
int main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  sum[0][0] = 1;
  for (long long i = 1; i <= k; i++) {
    sum[0][i] += sum[0][i - 1];
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (a[i] >= j)
        dp[i][j] = (dp[i][j] + sum[i - 1][j]) % MOD;
      else
        dp[i][j] = (dp[i][j] + sum[i - 1][j] - sum[i - 1][j - a[i] - 1]) % MOD;
      if (j)
        sum[i][j] = (sum[i][j - 1] + dp[i][j]) % MOD;
      else
        sum[i][j] = dp[i][j];
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
