#include <bits/stdc++.h>
using namespace std;
long long dp[200105][105];
long long MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(11);
  long double pi = 3.14159265358979323846;
  long long n, k;
  cin >> n >> k;
  long long ar[n];
  for (long long i = 0, _n = (n); i < _n; i++) {
    cin >> ar[i];
  }
  for (long long i = k; i >= max(k - ar[0], 0ll); i--) {
    dp[i][0] = 1 + dp[i + 1][0];
  }
  for (long long i = k - ar[0] - 1; i >= 0; i--) {
    dp[i][0] += dp[i + 1][0];
  }
  for (long long i = 1; i < n; i++) {
    for (long long j = k; j >= 0; j--) {
      dp[j][i] +=
          (dp[j + 1][i] + dp[j][i - 1] - dp[j + ar[i] + 1][i - 1]) % MOD;
    }
  }
  cout << dp[0][n - 1] - dp[1][n - 1];
  return 0;
}
