#include <bits/stdc++.h>
using namespace std;
long long int Mod = 1e9 + 7;
long long dp[103][100005];
long long rec(long A[], long can, long ind, long n, long k) {
  long long sum1 = 0, sum = 0, i;
  if (ind == n - 1 && k - can <= A[n] && can <= A[n])
    return (1);
  else if (ind == n - 1)
    return (0);
  for (i = 0; i <= A[ind + 1]; i++) {
    if (dp[ind + 1][can + i] != -1)
      sum = (sum + dp[ind + 1][can + i]) % Mod;
    else {
      dp[ind + 1][can + i] = rec(A, can + i, ind + 1, n, k);
      sum = (sum + dp[ind + 1][can + i]) % Mod;
    }
  }
  dp[ind][can] = sum;
  return (dp[ind][can]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long n, k, i, j, ans = 0;
  cin >> n >> k;
  long A[n + 1];
  A[0] = -1;
  for (i = 1; i <= n; i++) cin >> A[i];
  for (i = 0; i <= n; i++)
    for (j = 0; j <= k; j++) dp[i][j] = -1;
  ans = (ans + rec(A, 0, 0, n, k)) % Mod;
  cout << ans << endl;
}
