#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long A[110];
long long n, k;
long long B[110][101000];
int main() {
  cin >> n >> k;
  long long a;
  for (long long j = 0; j <= k; j++) {
    B[0][j] = 0;
  }
  B[0][0] = 1;
  A[0] = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> a;
    for (long long j = 0; j <= k; j++) {
      A[j + 1] = (A[j] + B[i - 1][j]) % MOD;
    }
    for (long long j = 0; j <= k; j++) {
      B[i][j] = (A[j + 1] - A[max(0LL, j - a)] + MOD) % MOD;
    }
  }
  cout << B[n][k] << endl;
  return 0;
}
