#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e2 + 5;
const int MAXNN = 1e5 + 5;
const int INF = 1e9 + 7;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
long long MOD(long long a) { return ((a % INF) + INF) % INF; }
long long inv(long long a) { return poww(a, INF - 2, INF); }
unsigned long long a[MAXN], sums[MAXN][MAXNN], dp[MAXN][MAXNN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 0; i <= k; ++i) sums[0][i] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      dp[i][j] = sums[i - 1][j];
      if (j >= a[i] + 1) dp[i][j] -= sums[i - 1][j - a[i] - 1];
    }
    sums[i][0] = dp[i][0] % INF;
    for (int j = 1; j <= k; ++j)
      sums[i][j] = sums[i][j - 1] + dp[i][j], dp[i][j] %= INF,
      sums[i][j] %= INF;
  }
  cout << dp[n][k] % INF;
}
