#include <bits/stdc++.h>
using namespace std;
const int size = 1e5 + 7;
const int N = 104;
long long int dp[N][size];
int arr[N];
int mod = 1e9 + 7;
long long int solve(int k, int n) {
  if (n == 0) {
    if (k == 0)
      return 1;
    else
      return 0;
  }
  if (k < 0) return 0;
  if (dp[n][k] != -1) return dp[n][k];
  long long int ans = 0;
  for (int x = 0; x <= arr[n - 1]; x++) {
    ans += solve(k - x, n - 1) % mod;
    ans %= mod;
  }
  ans %= mod;
  dp[n][k] = ans;
  return ans;
}
int main() {
  for (int x = 0; x < N; x++) {
    for (int i = 0; i < size; i++) dp[x][i] = -1;
  }
  int n, k;
  cin >> n >> k;
  for (int x = 0; x < n; x++) cin >> arr[x];
  cout << solve(k, n);
  return 0;
}
