#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f, MOD = 1e9 + 7;
int n, k;
int a[105];
int dp[105][N];
int pr[105][N];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j <= k; j++) {
    dp[0][j] = (a[0] >= j);
    if (j > 0) {
      pr[0][j] = (pr[0][j - 1] + dp[0][j]) % MOD;
    } else {
      pr[0][j] = dp[0][j];
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      int up_lim = j - a[i] - 1;
      if (up_lim >= 0) {
        dp[i][j] = (pr[i - 1][j] - pr[i - 1][up_lim]) % MOD;
      } else {
        dp[i][j] = pr[i - 1][j];
      }
      if (j > 0) {
        pr[i][j] = (pr[i][j - 1] + dp[i][j]) % MOD;
      } else {
        pr[i][j] = dp[i][j];
      }
    }
  }
  cout << dp[n - 1][k] << "\n";
  return 0;
}
