#include <bits/stdc++.h>
using namespace std;
long long int dp[100010] = {0};
long long int nextdp[100010] = {0};
signed main() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  dp[k] = 1;
  for (long long int i = 0; i < n; i++) {
    long long int nextdp[100010] = {0};
    for (long long int j = k; j >= 0; j--) {
      if (dp[j] == 0) continue;
      nextdp[j] += dp[j];
      nextdp[j] %= 1000000007;
      long long int nextPos = j - a[i] - 1;
      if (nextPos < 0) continue;
      nextdp[nextPos] -= dp[j];
    }
    for (long long int j = k; j >= 0; j--) {
      nextdp[j] += nextdp[j + 1];
      nextdp[j] %= 1000000007;
      dp[j] = nextdp[j];
    }
  }
  cout << dp[0] % 1000000007 << endl;
  return 0;
}
