#include <bits/stdc++.h>
using namespace std;
long long arr[107], st[2][400007], dp[2][100007];
long long n, K;
long long mod = 1e9 + 7;
void build(long long l, long long r, long long in) {
  if (l == r) {
    if (l <= arr[0]) st[0][in] = 1;
    return;
  }
  long long mid = (l + r) / 2;
  build(l, mid, 2 * in + 1);
  build(mid + 1, r, 2 * in + 2);
  st[0][in] = st[0][2 * in + 1] + st[0][2 * in + 2];
}
void update(long long i, long long l, long long r, long long in, long long pos,
            long long val) {
  if (l == r) {
    st[i][in] = val;
    return;
  }
  long long mid = (l + r) / 2;
  if (pos <= mid)
    update(i, l, mid, 2 * in + 1, pos, val);
  else
    update(i, mid + 1, r, 2 * in + 2, pos, val);
  st[i][in] = (st[i][2 * in + 1] + st[i][2 * in + 2]);
  if (st[i][in] >= mod) st[i][in] -= mod;
}
long long query(long long i, long long l, long long r, long long in,
                long long x, long long y) {
  if (x > r || l > y) return 0;
  if (x <= l && r <= y) return st[i][in];
  long long mid = (l + r) / 2;
  long long a = query(i, l, mid, 2 * in + 1, x, y) +
                query(i, mid + 1, r, 2 * in + 2, x, y);
  if (a >= mod) return a - mod;
  return a;
}
int main() {
  scanf("%lld%lld", &n, &K);
  long long i, j, k;
  for (i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
  }
  build(0, K, 0);
  for (i = 0; i <= arr[0]; i++) {
    dp[0][i] = 1;
  }
  long long q;
  for (i = 1; i < n; i++) {
    q = i % 2;
    for (k = 0; k <= K; k++) {
      long long a = 0;
      a = query(!q, 0, K, 0, k - min(k, arr[i]), k);
      update(q, 0, K, 0, k, a);
      dp[q][k] = a;
    }
  }
  cout << dp[q][K];
  return 0;
}
