#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 100;
const long long K = 100100;
long long DP[N][K];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < k + 1; i++) {
    if (i <= a[0])
      DP[0][i] = i + 1;
    else
      DP[0][i] = a[0] + 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < k + 1; j++) {
      if (j == 0)
        DP[i][j] = 1;
      else {
        DP[i][j] = DP[i][j - 1];
        DP[i][j] += DP[i - 1][j];
        if (j - 1 >= a[i]) DP[i][j] -= DP[i - 1][j - 1 - a[i]];
      }
      DP[i][j] %= MOD;
      DP[i][j] += MOD;
      DP[i][j] += MOD;
      DP[i][j] %= MOD;
    }
  }
  if (k == 0) {
    return cout << 1 << '\n', 0;
    ;
  } else
    cout << DP[n - 1][k] - DP[n - 1][k - 1] << endl;
}
