#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;
ll dp[110][100005];
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= K; ++j) {
      if (j == 0)
        dp[i][j] = dp[i - 1][j];
      else if (j - 1 - a[i - 1] >= 0)
        (dp[i][j] =
             dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1 - a[i - 1]]) %= MOD;
      else
        (dp[i][j] = dp[i][j - 1] + dp[i - 1][j]) %= MOD;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
