#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long dp[110][N];
long long a[N], pr[N];
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) pr[i] = pr[i - 1] + a[i];
  for (int i = 0; i <= k; i++) dp[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= min(pr[i], (long long)k); j++)
      dp[i][j] = (dp[i - 1][j] - (a[i] >= j ? 0 : dp[i - 1][j - a[i] - 1]) +
                  1000000007) %
                 1000000007;
    for (int j = 1; j <= k; j++)
      dp[i][j] = (dp[i][j - 1] + dp[i][j]) % 1000000007;
  }
  printf("%lld\n", dp[n][k] - dp[n][k - 1] % 1000000007);
}
