#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 2, K = 1e5 + 5, MOD = 1e9 + 7;
int numbers[N], n;
long long int dp[N][K];
int main() {
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> numbers[i];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i <= numbers[0]; i++) dp[1][i] = 1;
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= k; j++)
      dp[i][j] =
          dp[i][j - 1] + dp[i - 1][j] -
          ((j - numbers[i - 1] > 0) ? dp[i - 1][j - numbers[i - 1] - 1] : 0),
      dp[i][j] %= MOD;
  cout << (dp[n][k] % MOD) << endl;
}
