#include <bits/stdc++.h>
using namespace std;
long long int dp[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tests = 1;
  while (tests--) {
    long long int x, i, j, n, k;
    cin >> n >> k;
    dp[0] = 1;
    for (long long int i = 1; i <= n; i++) {
      cin >> x;
      vector<long long int> pre(k + 1, 0);
      for (j = 0; j <= k; j++) {
        long long int left = j + 1;
        long long int right = j + x;
        if (right >= left) {
          pre[left] += dp[j];
          pre[left] %= 1000000007;
          if (right + 1 <= k) {
            pre[right + 1] -= dp[j];
            pre[right + 1] = (pre[right + 1] + 1000000007) % 1000000007;
          }
        }
      }
      for (long long int j = 1; j <= k; j++) {
        pre[j] += pre[j - 1];
        pre[j] = (pre[j] + 1000000007) % 1000000007;
        dp[j] += pre[j];
        dp[j] = (dp[j] + 1000000007) % 1000000007;
      }
    }
    cout << dp[k];
  }
  return 0;
}
