#include <bits/stdc++.h>
using namespace std;
long dpss[(100L) + 1][(100000L) + 1], acc_dpss[(100L) + 1][(100000L) + 2];
int main() {
  long N, K, as[(100L)];
  scanf("%ld %ld", &N, &K);
  for (long i = 0; i < N; i++) {
    scanf("%ld", &as[i]);
  }
  acc_dpss[N][0] = 0;
  for (long j = 0; j <= K; j++) {
    dpss[N][j] = j == 0;
    acc_dpss[N][j + 1] = (acc_dpss[N][j] + dpss[N][j]) % (1000000007L);
  }
  for (long i = N - 1; i >= 0; i--) {
    for (long j = 0; j <= K; j++) {
      dpss[i][j] =
          (acc_dpss[i + 1][j + 1] - acc_dpss[i + 1][max(j - as[i], 0L)]) %
          (1000000007L);
    }
    acc_dpss[i][0] = 0;
    for (long j = 0; j <= K; j++) {
      acc_dpss[i][j + 1] = (acc_dpss[i][j] + dpss[i][j]) % (1000000007L);
    }
  }
  printf("%ld\n", dpss[0][K]);
}
