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