#include <bits/stdc++.h>
using namespace std;
const int INF = 1e+9;
const long long INFLL = 1e+17;
const long long MOD = 1e+9 + 7;
long long dp[110][100010];
int main() {
  int n, k;
  cin >> n >> k;
  int a[110];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) dp[0][i] = 0;
  for (int i = 0; i < n + 1; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j - a[i - 1] - 1 >= 0) {
        dp[i][j] =
            (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - a[i - 1] - 1]) % MOD;
      } else {
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
      }
    }
  }
  cout << dp[n][k] << "\n";
  return 0;
}
