#include <bits/stdc++.h>
using namespace std;
long long N, K;
long long dp[100010];
long long a[100010];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K;
  dp[0] = 1;
  for (long long i = 0; i < N; i++) {
    long long limit;
    cin >> limit;
    vector<long long> fake(K + 1);
    for (long long j = K; j >= 0; j--) {
      if (j + 1 <= K) {
        fake[j + 1] = (fake[j + 1] + dp[j]) % 1000000007;
        if (j + limit < K) {
          fake[j + limit + 1] = (fake[j + limit + 1] - dp[j]) % 1000000007;
        }
      }
    }
    long long pref = 0;
    for (long long j = 0; j <= K; j++) {
      pref = (pref + fake[j]) % 1000000007;
      dp[j] = (dp[j] + pref) % 1000000007;
    }
  }
  cout << dp[K] % 1000000007 << endl;
  return 0;
}
