#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e2 + 2;
const int maxk = 1e5 + 5;
const int base = 1e9 + 7;
int N, K;
int a[maxn];
int f[maxn][maxk];
int cal(int i, int k) {
  int &ret = f[i][k];
  if (ret != -1) return ret;
  if (i == N) {
    ret = (K - k <= a[i]);
    return ret;
  }
  ret = 0;
  for (int j = 0; j <= a[i]; ++j)
    if (k + j <= K) ret = (ret + cal(i + 1, k + j)) % base;
  return ret;
}
int main() {
  cin >> N >> K;
  for (int i = 1; i <= N; ++i) cin >> a[i];
  memset(f, 255, sizeof(f));
  cout << cal(1, 0) << endl;
}
