#include <bits/stdc++.h>
using namespace std;
long long int n, k, a, i, dp[100001], m = 1e9 + 7, j;
int main() {
  cin >> n >> k;
  dp[k] = 1;
  for (i = 0; i < n; i++) {
    cin >> a;
    for (j = k; j >= 0; j--) dp[j] += dp[j + 1];
    for (j = 0; j < k; j++) dp[j] = (dp[j] - dp[j + a + 1]) % m;
  }
  cout << dp[0];
}
