#include <bits/stdc++.h>
using namespace std;
const int maxn = 105, maxk = 1e5 + 5;
const int mod = 1e9 + 7;
int N, K, a[maxn], sum[maxn], dp[maxn][maxk];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (i == 0)
      sum[i] = a[i];
    else
      sum[i] = sum[i - 1] + a[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < N; i++) {
    dp[i + 1][0] = 1;
    for (int k = 1; k <= K; k++) {
      dp[i + 1][k] = ((dp[i + 1][k - 1] + dp[i][k]) % mod -
                      (k - 1 >= a[i] ? dp[i][k - 1 - a[i]] : 0) % mod) %
                     mod;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
