#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 2;
const int M = 1e5 + 2;
const long long mod = 1e9 + 7;
const int inf = 1e9;
const long long INF = 1e16;
void data() {}
long long dp[110][M], pr[110][M], n, k, a[110];
long long add(long long a, long long b) { return (a + b) % mod; }
int main() {
  data();
  scanf("%lld %lld", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  dp[0][0] = 1;
  for (int i = 0; i <= k; ++i) pr[0][i] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j)
      dp[i][j] = add(dp[i][j],
                     pr[i - 1][j] - (j > a[i] ? pr[i - 1][j - a[i] - 1] : 0LL));
    pr[i][0] = dp[i][0];
    for (int j = 0; j <= k; ++j) pr[i][j] = add(pr[i][j - 1], dp[i][j]);
  }
  printf("%lld", dp[n][k]);
}
