#include <bits/stdc++.h>
using namespace std;
long long n, k;
const long long MAX_N = 102, MAX_K = 1e5 + 2;
const long long mod = 1e9 + 7;
long long arr[MAX_N];
long long dp[MAX_N][MAX_K];
long long Top_Down(long long i = n, long long candies = k) {
  if (i == 0) return (candies == 0);
  if (dp[i][candies] != -1) return dp[i][candies] % mod;
  long long ways = 0;
  for (long long k = 0; k <= arr[i]; ++k) {
    if (candies >= k) ways += (Top_Down(i - 1, candies - k) % mod);
  }
  return (dp[i][candies] = ways % mod);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) cin >> arr[i];
  cout << Top_Down() % mod << "\n";
}
