#include <bits/stdc++.h>
using namespace std;
int M = 1e9 + 7;
int dp[101][100001];
long long f(int *a, int n, int k) {
  if (n >= 0 && k == 0) return 1;
  if (n == 0 && k > 0) return 0;
  if (dp[n][k] != -1) return dp[n][k];
  long long ans = 0;
  for (int i = 0; i <= min(a[n], k); i++) ans = (ans + f(a, n - 1, k - i)) % M;
  dp[n][k] = ans;
  return ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<vector<long long>> dpprefix(n + 1, vector<long long>(k + 1, 0));
  dpprefix[0][0] = 1;
  for (int child = 0; child <= n; child++) dpprefix[child][0] = 1;
  for (int candies = 1; candies <= k; candies++)
    dpprefix[0][candies] += dpprefix[0][candies - 1];
  for (int child = 1; child <= n; child++) {
    for (int candies = 1; candies <= k; candies++) {
      long long left = 0;
      if (candies - a[child] > 0)
        left = dpprefix[child - 1][candies - a[child] - 1];
      dpprefix[child][candies] = (dpprefix[child - 1][candies] - left + M) % M;
      dpprefix[child][candies] =
          (dpprefix[child][candies] + dpprefix[child][candies - 1]) % M;
    }
  }
  if (k != 0)
    cout << dpprefix[n][k] - dpprefix[n][k - 1];
  else
    cout << dpprefix[n][k];
  return 0;
}
