#include <bits/stdc++.h>
using namespace std;
int dp[101][100001];
int func(int start, int curr_k, int *arr, int n) {
  if (dp[start][curr_k] != -1) return dp[start][curr_k];
  if (curr_k == 0) {
    dp[start][curr_k] = 1;
    return dp[start][curr_k];
  }
  if (start == n - 1) {
    if (curr_k > arr[start]) {
      dp[start][curr_k] = 0;
      return 0;
    } else {
      dp[start][curr_k] = 1;
      return 1;
    }
  }
  int ways = 0;
  for (int i = 0; i <= arr[start]; i++) {
    if (curr_k - i >= 0)
      ways = (ways + func(start + 1, curr_k - i, arr, n) % 1000000007) %
             1000000007;
    else
      break;
  }
  dp[start][curr_k] = ways;
  return dp[start][curr_k];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  memset(dp, -1, sizeof(dp));
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << func(0, k, arr, n) << endl;
}
