#include <bits/stdc++.h>
using namespace std;
int MOD = 1000000007;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<vector<int>> DP(N, vector<int>(K + 1, 0));
  for (int i = 0; i <= A[0]; i++) {
    DP[0][i] = 1;
  }
  for (int i = 1; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      for (int last = 0; last <= min(A[i], j); last++) {
        DP[i][j] += DP[i - 1][j - last] % MOD;
      }
    }
  }
  cout << DP[N - 1][K] << endl;
  return 0;
}
