#include <bits/stdc++.h>
using namespace std;
int N, K;
int add(int a, int b) {
  return ((a % 1000000007) + (b % 1000000007)) % 1000000007;
}
int sub(int a, int b) {
  return ((a % 1000000007) - (b % 1000000007)) % 1000000007;
}
int DP[101][100001], prefix[101][100001];
int A[101];
int solve() {
  for (int i = 0; i <= N; i++) DP[i][0] = prefix[i][0] = 1;
  for (int i = 1; i <= K; i++) prefix[0][i] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= K; j++) {
      int first;
      if (j > A[i]) {
        first = prefix[i - 1][j - A[i] - 1];
      } else {
        first = 0;
      }
      int last = prefix[i - 1][j];
      DP[i][j] = sub(last, first);
      prefix[i][j] = add(DP[i][j], prefix[i][j - 1]);
    }
  }
  return 0;
}
int main() {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  solve();
  cout << DP[N][K] << "\n";
  return 0;
}
