#include <bits/stdc++.h>
using namespace std;
long long n, k, dp[105][200005], a[105];
int main(void) {
  scanf("%lld%lld", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", a + i);
  dp[0][k] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = k - 1; j >= 0; j--)
      dp[i - 1][j] = (dp[i - 1][j] + dp[i - 1][j + 1]) % 1000000007;
    for (int j = 0; j <= k; j++) {
      dp[i][j] = (dp[i - 1][j] - dp[i - 1][j + a[i] + 1]) % 1000000007;
      ;
    }
  }
  printf("%lld\n", dp[n][0]);
}
