#include <bits/stdc++.h>
using namespace std;
long long int N, K;
vector<long long int> V;
long long int dp[100005][105];
long long int fun(long long int sum, long long int i) {
  long long int ans = 0;
  if (i == 0) {
    if (sum >= 0 && sum <= V[0])
      dp[sum][i] = 1;
    else
      dp[sum][i] = 0;
  } else {
    for (auto j = 0; j <= V[i] && j <= sum; j++) {
      if (dp[sum - j][i - 1] == -1) dp[sum - j][i - 1] = fun(sum - j, i - 1);
      if (dp[sum - j][i - 1] > 0)
        ans = (ans % 1000000007 + dp[sum - j][i - 1] % 1000000007) % 1000000007;
    }
    dp[sum][i] = ans % 1000000007;
  }
  return (dp[sum][i] % 1000000007);
}
int main() {
  long long int ans, i, x, j;
  cin >> N >> K;
  for (i = 0; i < N; i++) {
    cin >> x;
    V.push_back(x);
  }
  ans = 0;
  for (i = 0; i < 100005; i++)
    for (j = 0; j < 105; j++) dp[i][j] = -1;
  if (N >= 2) {
    for (i = 0; i <= V[N - 1] && i <= K; i++) {
      dp[K - i][N - 2] = fun(K - i, N - 2);
      if (dp[K - i][N - 2] > 0) {
        ans = (ans % 1000000007 + dp[K - i][N - 2] % 1000000007) % 1000000007;
      }
    }
  } else {
    if (V[0] == K) ans = 1;
  }
  cout << ans << endl;
  return 0;
}
