#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
const int maxk = 1e5 + 10;
const int mod = 1e9 + 7;
int n, k;
int niz[maxn];
int dp[maxk];
int loga[maxk];
int query(int x) {
  int out = 0;
  for (x += 2; x > 0; x -= x & -x) out += loga[x], out %= mod;
  return out;
}
void update(int x, int val) {
  for (x += 2; x < maxk; x += x & -x) loga[x] += val, loga[x] %= mod;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", niz + i);
  dp[0] = 1;
  update(0, 1);
  for (int i = 0; i < n; i++) {
    for (int j = k; j > 0; j--) {
      int tren = (query(j) - query(max(0, j - niz[i]) - 1) + mod) % mod;
      update(j, -dp[j]);
      dp[j] = tren;
      update(j, tren);
    }
  }
  printf("%d", dp[k]);
  return 0;
}
