#include <bits/stdc++.h>
using namespace std;
int N, K;
int A[105];
long long int MOD = 1e9 + 7;
long long int dp[100005][103];
long long int backtrack(int ind, int K) {
  if (K == 0) {
    return 1;
  } else if (K < 0 || ind >= N)
    return 0;
  if (dp[K][ind]) return dp[K][ind];
  long long int sum = 0;
  for (int i = 0; i <= A[ind]; ++i) sum += backtrack(ind + 1, K - i) % MOD;
  dp[K][ind] = sum % MOD;
  return dp[K][ind];
}
int main() {
  cin >> N;
  cin >> K;
  for (int i = 0; i < N; ++i) cin >> A[i];
  printf("%lld\n", backtrack(0, K) % MOD);
  return 0;
}
