#include <bits/stdc++.h>
using namespace std;
const long long N = 109, K = 100009, MOD = 1e9 + 7;
long long n, k, a[N], dp[N][K], dp2[N][K];
long long dpsum(long long first, long long i, long long j) {
  if (i == 0)
    return dp2[first][j];
  else
    return dp2[first][j] - dp2[first][i - 1];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long i = 1; i <= n; ++i) dp[i][0] = dp2[i][0] = 1;
  for (long long j = 1, i = 1; j <= k; ++j) {
    if (j <= a[i]) {
      dp[i][j] = 1;
    }
    dp2[i][j] += dp2[i][j - 1] + dp[i][j];
    dp[i][j] %= MOD;
    dp2[i][j] %= MOD;
  }
  for (long long i = 2; i <= n; ++i) {
    for (long long j = 1; j <= k; ++j) {
      long long t = max(0LL, j - a[i]);
      dp[i][j] = dpsum(i - 1, t, j);
      dp2[i][j] += dp2[i][j - 1] + dp[i][j];
      dp[i][j] %= MOD;
      dp2[i][j] %= MOD;
    }
  }
  cout << dp[n][k] << endl;
}
