#include <bits/stdc++.h>
const long long MAX_N = 1e5 + 5;
const long long MOD = 1e9 + 7;
using namespace std;
int dp1[MAX_N];
int dp2[MAX_N];
int sum[MAX_N];
int a[MAX_N];
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  dp1[0] = 1;
  for (int i = 0; i <= k; ++i) sum[i] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      dp2[j] += dp1[j];
      if (j - a[i] <= 0)
        dp2[j] = sum[j];
      else
        dp2[j] = (sum[j] - sum[j - a[i] - 1] + MOD) % MOD;
      dp2[j] %= MOD;
    }
    sum[0] = 1;
    for (int j = 1; j <= k; ++j) sum[j] = (sum[j - 1] + dp2[j]) % MOD;
    memcpy(dp1, dp2, sizeof dp1);
    memset(dp2, 0, sizeof(dp2));
    dp2[0] = 1;
  }
  cout << dp1[k];
  return 0;
}
