#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
const int MAXK = 1e5;
const long long MOD = 1e9 + 7;
int N, K, arr[MAXN + 10];
long long dp[MAXN + 10][MAXK + 10];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  int i, j;
  scanf("%d%d", &N, &K);
  for (i = 1; i <= N; i++) scanf("%d", &arr[i]);
  for (i = 0; i <= K; i++) dp[0][i] = 1;
  for (i = 1; i <= N; i++) {
    for (j = 0; j <= K; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j >= arr[i])
        dp[i][j] = (dp[i][j] - dp[i - 1][j - arr[i] - 1] + MOD) % MOD;
      dp[i][j] = (dp[i][j - 1] + dp[i][j]) % MOD;
    }
  }
  printf("%lld", dp[N][K] - dp[N][K - 1]);
  return 0;
}
