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