#include <bits/stdc++.h>
using namespace std;
static const int MAX_N = 100;
static const int MAX_K = 100000;
static const long long int MOD = 1000000007;
int N, K;
int a[MAX_N + 1];
long long int memo[MAX_N + 1][MAX_K + 1], memo2[MAX_N + 1][MAX_K + 2];
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i < N + 1; i++) scanf("%d", &a[i]);
  memo[0][0] = 1LL;
  int sum = 0;
  for (int j = 1; j <= K + 1; j++)
    memo2[0][j] = memo2[0][j - 1] + memo[0][j - 1];
  for (int i = 1; i < N + 1; i++) {
    sum += a[i];
    for (int j = 0; j <= sum; j++) {
      memo[i][j] = memo2[i - 1][j + 1] - memo2[i - 1][max(0, j - a[i])];
      memo[i][j] %= MOD;
    }
    for (int j = 1; j <= K + 1; j++) {
      memo2[i][j] = memo2[i][j - 1] + memo[i][j - 1];
      memo2[i][j] %= MOD;
    }
  }
  printf("%lld\n", memo[N][K]);
  return 0;
}
