#include <bits/stdc++.h>
using namespace std;
long long f[101][100001], sum[101][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 = 0; i <= K; i++) sum[0][i] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= K; j++) {
      if (j > a[i])
        f[i][j] += sum[i - 1][j] - sum[i - 1][j - a[i] - 1] % 1000000007;
      else
        f[i][j] += sum[i - 1][j] % 1000000007;
      sum[i][j] = sum[i][j - 1] + f[i][j] % 1000000007;
    }
  }
  printf("%lld", f[n][K]);
  return 0;
}
