#include <bits/stdc++.h>
using namespace std;
int N, K;
int a[110];
int memo[110][100010] = {-1};
int solve(int N, int K) {
  if (memo[N][K] != -1) return memo[N][K];
  if (N == 1) {
    if (K <= a[1]) {
      memo[N][K] = 1;
    } else {
      memo[N][K] = 0;
    };
    if (K <= a[1]) {
      return 1;
    } else {
      return 0;
    };
  }
  int res = 0;
  for (int i = 0; i < a[N] + 1; i++) {
    res += solve(N - 1, K - i);
    if (res >= 1000000007) res -= 1000000007;
  };
  memo[N][K] = res;
  return res;
}
int main() {
  cin >> N >> K;
  a[0] = 0;
  for (int k = 1; k < N + 1; k++) {
    cin >> a[k];
  };
  cout << solve(N, K) << endl;
}
