#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1e9 + 7;
long long N, K;
long long a[100];
long long memo[101][100001];
long long dfs(long long i, long long sum) {
  if (i == N) {
    if (sum == K)
      return 1;
    else
      return 0;
  }
  long long ret = 0;
  for (long long j = 0, j_len = (a[i] + 1); j < j_len; ++j) {
    if (sum + j > K) break;
    ret = (ret + dfs(i + 1, sum + j)) % mod;
  }
  return memo[i][sum] = ret;
}
signed main() {
  cin >> N >> K;
  for (long long i = 0, i_len = (N); i < i_len; ++i) cin >> a[i];
  cout << dfs(0, 0) << endl;
}
