#include <bits/stdc++.h>
using namespace std;
int MOD = 1e9 + 7;
long long int a[103];
long long int n, K;
long long int dp[103][(long long int)(1e5 + 1)];
int main() {
  cin >> n >> K;
  memset(dp, 0, sizeof dp);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    vector<long long int> to_add(K + 1);
    for (long long int used = 0; used <= K; used++) {
      long long int L = used;
      long long int R = used + min(K - used, a[i]);
      to_add[L] += dp[i][used];
      if (R + 1 <= K) to_add[R + 1] += (-dp[i][used]);
    }
    long long int pref_sum = 0;
    for (int j = 0; j <= K; j++) {
      pref_sum += to_add[j];
      dp[i + 1][j] = pref_sum;
    }
  }
  cout << (dp[n][K] % MOD) << endl;
  return 0;
}
