#include <bits/stdc++.h>
using namespace std;
int rec(int curr, int l, int* A, int K, int glo[][100], int N) {
  if (curr > K) {
    return 0;
  }
  if (l == N) {
    if (A[N - 1] + curr >= K) {
      return 1;
    } else {
      return 0;
    }
  }
  if (glo[curr][l] == -1) {
    int tot = 0;
    int mod = 1000000007;
    for (int i = 0; i <= A[l - 1]; i++) {
      tot = (tot + (rec(curr + i, l + 1, A, K, glo, N)) % mod) % mod;
    }
    glo[curr][l] = tot;
    return tot;
  } else {
    return glo[curr][l];
  }
  return 0;
}
int main() {
  int N, K;
  cin >> N >> K;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int glo[K + 1][100];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      glo[j][i] = -1;
    }
  }
  int mod = 1000000007;
  int res = 0;
  if (N == 1) {
    int tot = A[0] - K + 1;
    if (tot > 0) {
      cout << tot << endl;
    } else {
      cout << "0" << endl;
    }
    return 0;
  } else {
    for (int i = 0; i <= A[0]; i++) {
      res = (res + (rec(i, 2, A, K, glo, N) % mod)) % mod;
    }
    cout << res << endl;
  }
  return 0;
}
