#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e2 + 2;
const int MAX_K = 1e5 + 5;
const int MOD = 1000000007;
int n, k;
int a[MAX_N];
long long dp[2][MAX_K];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  bool f = 0;
  dp[f ^ 1][k] = 1;
  for (int i = 0; i < n; i++, f ^= 1) {
    memset(dp[f], 0, sizeof(dp[f]));
    for (int j = 0; j <= k; j++) {
      dp[f][j] = (dp[f][j] + dp[f ^ 1][j]) % MOD;
      if (j - a[i] - 1 >= 0)
        dp[f][j - a[i] - 1] = (dp[f][j - a[i] - 1] - dp[f ^ 1][j]) % MOD;
    }
    for (int j = k; j >= 0; j--) dp[f][j] = (dp[f][j] + dp[f][j + 1]) % MOD;
  }
  printf("%lld\n", dp[f ^ 1][0]);
  return 0;
}
