#include <bits/stdc++.h>
using namespace std;
long long dp[100005];
long long ndp[100005];
const int MOD = 1000000007;
int n, k;
void solve() {
  cin >> n >> k;
  dp[0] = 1;
  while (n--) {
    int t;
    cin >> t;
    memset(ndp, 0, sizeof(ndp));
    long long curr = 0;
    for (int i = 0; i <= k; i++) {
      curr += dp[i];
      curr %= MOD;
      curr += MOD;
      curr %= MOD;
      ndp[i] += curr;
      ndp[min(k + 1, i + t + 1)] -= curr;
    }
    memcpy(dp, ndp, sizeof(dp));
  }
  cout << dp[k] << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
