#include <bits/stdc++.h>
using namespace std;
long long i, t, j, md = 1e9 + 7;
long long n, k, a[105], ps[105][100005], cnt;
long long dp[105][100005];
int main() {
  if (0) {
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
  }
  scanf("%lld%lld", &n, &k);
  for (i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  dp[0][0] = 1;
  for (j = 0; j <= k; ++j) ps[0][j] = 1;
  for (i = 1, cnt = a[1]; i <= n; ++i) {
    for (j = 0; j <= k; ++j) {
      if (j - a[i] <= 0)
        dp[i][j] = (dp[i][j] + ps[i - 1][j]) % md;
      else
        dp[i][j] = (dp[i][j] + ps[i - 1][j] - ps[i - 1][j - a[i] - 1]) % md;
      ps[i][j] = (ps[i][j - 1] + dp[i][j]) % md;
    }
  }
  printf("%lld\n", dp[n][k]);
  return 0;
}
