#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, 1, -1};
template <typename T>
T GCD(T u, T v) {
  return v ? GCD(v, u % v) : u;
}
int dp[105][100005], sp[105][100005];
int main() {
  int N, K;
  cin >> N >> K;
  int a[105];
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= K; j++) {
      sp[i - 1][j] = dp[i - 1][j];
      if (j > 0) {
        sp[i - 1][j] =
            (1LL * sp[i - 1][j] + 1LL * sp[i - 1][j - 1]) % 1000000000 + 7;
      }
      dp[i][j] = sp[i - 1][j];
      if (j > a[i]) {
        dp[i][j] -= sp[i - 1][j - a[i] - 1];
      }
      if (dp[i][j] < 0) {
        dp[i][j] += 1000000000 + 7;
      }
    }
  }
  cout << dp[N][K] << endl;
}
