#include <bits/stdc++.h>
using namespace std;
long long int n, k;
long long int arr[105];
long long int dp[105][100005];
long long int md = 1e9 + 7;
long long int solve(long long int u, long long int rem) {
  if (u == n) {
    if (rem == 0)
      return 1;
    else
      return 0;
  }
  if (rem < 0) return 0;
  if (dp[u][rem] == -1) {
    long long int val = 0;
    for (long long int i = 0; i <= arr[u] && i <= rem; i++) {
      val = (val + solve(u + 1, rem - i)) % md;
    }
    dp[u][rem] = val;
  }
  return dp[u][rem];
}
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << solve(0, k) << '\n';
}
