#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n, k;
long long dp[105][100005];
long long arr[105];
long long solve(long long index, long long k_remaining) {
  if (index == n) {
    if (k_remaining == 0)
      return 1;
    else
      return 0;
  }
  if (dp[index][k_remaining] != -1) return dp[index][k_remaining];
  long long &ans = dp[index][k_remaining];
  ans = 0;
  for (long long i = 0; i <= arr[index]; i++) {
    if (k_remaining - i == 0) {
      ans = (ans + 1) % MOD;
      break;
    }
    ans = (ans + solve(index + 1, k_remaining - i)) % MOD;
  }
  return ans;
}
int32_t main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << solve(0, k) << "\n";
  return 0;
}
