#include <bits/stdc++.h>
using namespace std;
int64_t a[102], dp[102][100004], s[102][100005];
signed main() {
  int64_t n, i, j, k, w = 0, t;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++)
    for (j = 0; j <= k; j++) {
      int64_t v = s[i - 1][j + 1] - s[i - 1][max(w, j - a[i])];
      if (v < 0) v = v + 1000000007;
      dp[i][j] = (v + dp[i][j]) % 1000000007;
      s[i][j + 1] = (s[i][j] + dp[i][j]) % 1000000007;
    }
  cout << dp[n][k] << "\n";
}
