#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int n, k;
int dp[101][100001];
int S[101][100001];
int a[100001];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  S[0][0] = 1;
  for (int i = 1; i <= k; i++) S[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] =
          (S[i - 1][j] - (j - a[i] - 1 >= 0 ? S[i - 1][j - a[i] - 1] : 0)) %
          MOD;
    }
    S[i][0] = dp[i][0];
    for (int j = 1; j <= k; j++) S[i][j] = (1ll * S[i][j - 1] + dp[i][j]) % MOD;
  }
  cout << dp[n][k];
  return 0;
}
