#include <bits/stdc++.h>
using namespace std;
int **dp;
int *arr;
int func(int n, int k) {
  if (k < 0) {
    return 0;
  }
  if (n == 1) {
    if (k <= arr[n]) {
      return 1;
    } else
      return 0;
  }
  if (dp[n][k] != -1) {
    return dp[n][k];
  }
  int ans = 0;
  for (int i = 0; i <= arr[n]; i++) {
    ans = (ans + func(n - 1, k - i)) % 1000000007;
  }
  return dp[n][k] = ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  dp = new int *[n + 1];
  for (int i = 0; i <= n; i++) {
    dp[i] = new int[k + 1];
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = -1;
    }
  }
  arr = new int[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  std::cout << func(n, k) << endl;
  return 0;
}
