#include <bits/stdc++.h>
using namespace std;
long long int M = 1000000007;
vector<long long int> P(100005, 1);
long long int getsum(long long int l, long long int r) {
  if (l == 0) return P[r];
  return P[r] - P[l - 1];
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, k;
  cin >> n >> k;
  vector<long long int> A(n);
  for (long long int i = 0; i < n; i++) cin >> A[i];
  vector<vector<long long int>> dp(n + 1, vector<long long int>(k + 1, 0));
  for (long long int i = 0; i < n + 1; i++) dp[i][0] = 1;
  for (long long int i = 1; i < n + 1; i++) {
    for (long long int j = 1; j < k + 1; j++) {
      long long int t =
          getsum(max((long long)0, j - A[i - 1]), min(A[i - 1], j));
      dp[i][j] = t;
    }
    for (long long int j = 1; j < k + 1; j++) P[j] = P[j - 1] + dp[i][j];
  }
  cout << dp[n][k] % M << endl;
}
