#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n + 1, 0);
  for (long long i = 1; i <= n; i++) cin >> v[i];
  for (long long i = n; i >= 1; i--) {
    dp[i][0] = 1;
    for (long long j = 1; j <= k; j++) {
      if (i != n) {
        if (j >= v[i] + 1)
          dp[i][j] = (dp[i][j] + dp[i][j - 1] + dp[i + 1][j] -
                      dp[i + 1][j - v[i] - 1]) %
                     1000000007;
        else
          dp[i][j] = (dp[i][j] + dp[i][j - 1] + dp[i + 1][j]) % 1000000007;
      } else {
        if (j <= v[n]) dp[n][j] = 1;
      }
    }
  }
  cout << dp[1][k] << "\n";
  return 0;
}
