#include <math.h>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N, 0);
  for (int i = 0; i < N; ++i) cin >> a[i];

  vector<vector<int>> table(N + 1, vector<int>(K + 1, 0));
  int mod = pow(10, 9) + 7;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= K; ++j) {
      if (i == 1) {
        if (a[0] >= j)
          table[i][j] = 1;
        else
          table[i][j] = 0;
      } else if (j == 0) {
        table[i][j] = 1;
      } else {
        table[i][j] = (table[i - 1][j];
        if (j > a[i - 1]) table[i][j] -= table[i - 1][j - a[i - 1] - 1];
        table[i][j] %= mod;
        table[i][j] += table[i][j - 1]);
        table[i][j] %= mod;
      }
    }
  }
  cout << table[N][K];
}