#include <bits/stdc++.h>
using namespace std;
long long int dp[105][100005], x[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int N, K;
  cin >> N >> K;
  long long int a[N], i, j, k;
  for (i = 0; i < N; i++) cin >> a[i];
  for (i = 0; i < N; i++) {
    for (j = 0; j <= K; j++) {
      if (i == 0) {
        if (j <= a[i]) dp[i][j] = 1;
      } else if (j == 0)
        dp[i][j] = 1;
      else {
        if (j - (a[i] + 1) >= 0)
          dp[i][j] = x[j] - x[j - (a[i] + 1)];
        else
          dp[i][j] = x[j];
      }
    }
    memset(x, 0, sizeof x);
    x[0] = dp[i][0];
    for (long long int i1 = 1; i1 <= K; i1++) {
      x[i1] = x[i1 - 1] + dp[i][i1];
      if (x[i1] >= 1000000007) x[i1] -= 1000000007;
    }
  }
  printf("%lld", dp[N - 1][K]);
  return 0;
}
