#include <bits/stdc++.h>
using namespace std;
const long long mxn = 1e5 + 10, mod = 1e9 + 7;
long long dp[101][mxn], aux[101][mxn];
long long n, k;
long long a[mxn];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long j = 1; j <= k; j++) {
    dp[0][j] = 0;
    aux[0][j] = 1;
  }
  aux[0][0] = dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    aux[i][0] = dp[i][0] = 1;
    for (long long j = 1; j <= k; j++) {
      long long count = j - min(j, a[i]);
      if (count == 0)
        dp[i][j] = aux[i - 1][j];
      else
        dp[i][j] = (aux[i - 1][j] - aux[i - 1][count - 1]) % mod;
    }
    for (long long j = 1; j <= k; j++)
      aux[i][j] = (aux[i][j - 1] + dp[i][j]) % mod;
  }
  cout << dp[n][k];
  return 0;
}
