#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
long long int dp[101][100001];
long long int arr[101];
long long int solve(long long int n, long long int k) {
  if (dp[n][k] != -1) return dp[n][k];
  if (n == 0) {
    if (k > arr[n])
      return 0;
    else
      return 1;
  }
  long long int aux = 0;
  for (long long int i = 0; i <= arr[n]; i++) {
    if (k - i < 0) continue;
    aux += solve(n - 1, k - i) % MOD;
    aux = aux % MOD;
  }
  return dp[n][k] = aux;
}
int main(void) {
  memset(dp, -1, sizeof dp);
  long long int n, k;
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  cout << solve(n - 1, k) << endl;
  return 0;
}
