#include <bits/stdc++.h>
using namespace std;
const int N = 105, K = 100005, M = 1e9 + 7;
int n, k, a[N];
long long dp[N][K];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    dp[i][0] = 1;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 1; j <= k; j++) {
      if (i == n - 1) {
        if (j <= a[i]) {
          dp[i][j] = dp[i][j - 1] + 1;
        } else {
          dp[i][j] = dp[i][j - 1];
        }
      } else {
        int h = j, l = max(0, j - a[i]);
        dp[i][j] =
            dp[i][j - 1] +
            (l == 0 ? dp[i + 1][h] : dp[i + 1][h] - dp[i + 1][l - 1] + M);
        dp[i][j] %= M;
      }
    }
  }
  cout << dp[0][k] - dp[0][k - 1];
}
