#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
long long n, k, bd[101][200001], a;
int main() {
  cin >> n >> k;
  memset(bd, 0, sizeof(bd));
  bd[0][k] = 1;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    bd[i][k] = 1;
    for (int j = k - 1; j >= 0; j--) {
      bd[i][j] = (bd[i][j + 1] - bd[i - 1][j + a + 1] + bd[i - 1][j]) % M;
    }
  }
  cout << bd[n][0] << "\n";
}
