#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 101;
const long long MAX_K = 100001;
const long long MOD = 1000000007;
int N;
long long K, cum, a[MAX_N], dp[MAX_N][MAX_K];
long long add(long long a, long long b) { return (a + b) % MOD; }
long long sub(long long a, long long b) {
  return (a - b) < 0 ? (a - b + MOD) : (a - b);
}
int main() {
  scanf("%d %lld", &N, &K);
  for (int i = 0; i < N; ++i) scanf("%lld", &a[i]);
  cum = a[0];
  for (long long c = 0; c <= min(cum, K); ++c) dp[0][c] = 1;
  for (int i = 0; i + 1 < N; ++i) {
    for (long long c = 0; c <= min(cum, K); ++c)
      dp[i + 1][c] = c ? add(dp[i][c], dp[i + 1][c - 1]) : dp[i][c];
    for (long long c = cum + 1; c <= min(cum + a[i + 1], K); ++c)
      dp[i + 1][c] = c - a[i + 1] - 1 >= 0
                         ? sub(dp[i + 1][c - 1], dp[i][c - a[i + 1] - 1])
                         : dp[i + 1][c - 1];
    cum += a[i + 1];
  }
  printf("%lld\n", dp[N - 1][K]);
  return 0;
}
