#include <bits/stdc++.h>
using namespace std;
const long long N = 105;
const long long K = 100005;
long long dp[N][K];
long long a[N];
long long pre[K];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (long long i = 0; i <= k; i++) pre[i] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j <= a[i])
        dp[i][j] = pre[j];
      else
        dp[i][j] = (pre[j] - pre[j - a[i] - 1]) % 1000000007;
    }
    for (long long j = 0; j <= k; j++) {
      if (j != 0)
        pre[j] = (pre[j - 1] + dp[i][j]) % 1000000007;
      else
        pre[j] = dp[i][j];
    }
  }
  cout << dp[n][k];
}
