#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
const int MOD = 1e9 + 7;
int n, k, dp[102][M], t[102];
int main() {
  cin >> n >> k;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
    dp[i][0] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
      if (j - t[i] - 1 >= 0)
        dp[i][j] = (dp[i][j] - dp[i - 1][j - t[i] - 1]) % MOD;
    }
  }
  cout << dp[n][k];
}
