#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
long long int dp[105][100005], sum[105][100005];
int N, K;
int a[100005];
int main(void) {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
  }
  dp[0][K] = 1;
  for (int i = 1; i <= N; i++) {
    sum[i - 1][0] = dp[i - 1][0];
    for (int j = 1; j <= K; j++) {
      sum[i - 1][j] = (sum[i - 1][j - 1] + dp[i - 1][j]) % MOD;
    }
    dp[i][0] = sum[i - 1][min(K, 0 + a[i])];
    for (int k = 0; k <= K; k++) {
      dp[i][k] = (sum[i - 1][min(K, k + a[i])] - sum[i - 1][k - 1] + MOD) % MOD;
    }
  }
  cout << dp[N][0] << endl;
  return 0;
}
