#include <bits/stdc++.h>
using namespace std;
const long long P = 1e9 + 7;
long long tab[105][100005];
long long limit[105];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  long long x, n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    limit[i] = x;
  }
  for (long long i = 0; i <= k; i++) tab[0][i] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      long long w = tab[i - 1][j];
      if (j - min(limit[i], j) - 1 != -1)
        w -= tab[i - 1][j - min(limit[i], j) - 1];
      w = w % P;
      tab[i][j] = (w + tab[i][j - 1]) % P;
    }
  }
  cout << tab[n][k] - tab[n][k - 1] << "\n";
  return 0;
}
