#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, K, A[100], MOD = 1000000007;
  static long long DP[110][10010] = {};
  DP[0][0] = 1;
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) {
    static long long SUM[10010] = {};
    for (int j = 0; j <= K; j++) {
      SUM[j + 1] = (SUM[j] + DP[i][j]) % MOD;
    }
    for (int j = 0; j <= K; j++) {
      DP[i + 1][j] = (SUM[j + 1] - SUM[max(0LL, j - A[i])] + MOD) % MOD;
    }
  }
  cout << DP[N][K] << endl;
}
