#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
const int K = 1e5 + 5;
long long n, k;
long long mod = 1e9 + 7;
long long a[N];
long long dp[N][K], dp1[N][K];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 0; i <= a[1]; ++i) {
    dp1[1][i] = i + 1;
    dp[1][i] = 1;
  }
  for (int i = a[1] + 1; i <= k; ++i) dp1[1][i] = dp1[1][i - 1];
  for (int i = 1; i <= n; ++i) {
    dp1[i][0] = 1;
    dp[i][0] = 1;
  }
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      dp[i][j] =
          (dp[i][j] + (dp1[i - 1][j] -
                       ((j - a[i] - 1 >= 0) ? dp1[i - 1][j - a[i] - 1] : 0))) %
          mod;
      dp1[i][j] = (dp[i][j] + dp1[i][j - 1]) % mod;
    }
  }
  cout << dp[n][k] << endl;
}
