#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 100, MODD = 1e9 + 7;
long long dp[200][N], par_sum[200][N];
int main() {
  long long n, k, a;
  cin >> n >> k;
  dp[0][0] = 1;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 0; j <= k; ++j) {
      par_sum[i][j + 1] = par_sum[i][j] + dp[i - 1][j];
      par_sum[i][j + 1] %= MODD;
    }
    cin >> a;
    for (long long j = 0; j <= k; ++j) {
      dp[i][j] = par_sum[i][j + 1];
      if (j - a >= 1) dp[i][j] -= par_sum[i][j - a];
    }
  }
  cout << dp[n][k] << '\n';
}
