#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n, k, i, lim;
int dp[100001];
int pre[100001];
int main() {
  scanf("%d%d", &n, &k);
  fill(pre, pre + k + 1, 1);
  while (n--) {
    scanf("%d", &lim);
    for (i = 0; i <= k; i++) {
      dp[i] = pre[i];
      if (i - lim - 1 >= 0) {
        dp[i] -= pre[i - lim - i];
        if (dp[i] < 0) dp[i] += mod;
      }
    }
    for (i = 1; i <= k; i++) {
      pre[i] = pre[i - 1] + dp[i];
      if (pre[i] >= mod) pre[i] -= mod;
    }
  }
  printf("%d\n", dp[k]);
  return 0;
}
