#include <bits/stdc++.h>
using namespace std;
long long n;
long long dp[109][100009];
long long const mod = 1e9 + 7;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long k;
  cin >> n >> k;
  dp[0][k] = 1;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    for (long long j = k; j >= 0; j--) {
      long long l = j;
      long long r = j - min(j, a) - 1;
      dp[i + 1][l] += dp[i][j];
      dp[i + 1][l] %= mod;
      if (r != -1) dp[i + 1][r] -= dp[i][j];
      if (r != -1) dp[i + 1][r] %= mod;
    }
    long long tempo = 0;
    for (long long j = k; j >= 0; j--) {
      tempo += dp[i + 1][j];
      tempo %= mod;
      dp[i + 1][j] = tempo;
      dp[i + 1][j] %= mod;
    }
  }
  cout << dp[n][0] << endl;
}
