#include <bits/stdc++.h>
using namespace std;
int f[101][100001], sum[100001];
int a[101];
int main() {
  int n, k, i, j, K;
  scanf("%d %d", &n, &K);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[0][0] = 1;
  for (i = 1; i <= n; i++) {
    sum[0] = f[i - 1][0];
    for (j = 1; j <= K; j++) sum[j] = (sum[j - 1] + f[i - 1][j]) % 1000000007;
    for (j = 0; j <= K; j++) {
      if (j > a[i])
        f[i][j] = (sum[j] - sum[j - a[i] - 1]) % 1000000007;
      else
        f[i][j] = sum[j] % 1000000007;
    }
  }
  printf("%d", f[n][K]);
  return 0;
}
