#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long dp[105][100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (i == 1)
        dp[i][j] = a[i] >= j ? 1 : 0;
      else if (j == 0)
        dp[i][j] = 1;
      else {
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
        if (j - 1 - a[i] >= 0) dp[i][j] -= dp[i - 1][j - 1 - a[i]];
      }
      dp[i][j] %= mod;
    }
  }
  cout << dp[n][k] << '\n';
}
