#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5, inf = 1e9 + 7;
long long n, k, i, j;
long long A[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long i, j, a, b, ans = 0;
  cin >> n >> k;
  vector<long long> dp(k + 1, 0), temp(k + 1, 0);
  dp[0] = 1;
  for (i = 1; i < n + 1; i++) {
    cin >> A[i];
    temp[0] = dp[0];
    for (j = 1; j < k + 1; j++) {
      temp[j] = temp[j - 1] + dp[j];
      if (j > A[i]) temp[j] -= dp[j - A[i] - 1];
      if (temp[j] > inf) temp[j] -= inf;
    }
    dp = temp;
  }
  (dp[k] %= inf) += inf;
  cout << dp[k] % inf;
}
