#include <bits/stdc++.h>
using namespace std;
long long M[100][100001];
int A[100];
void filly(int n, int k) {
  for (int i = 1; i < n; i++)
    for (int j = 1; j <= k; j++) {
      M[i][j] = M[i][j - 1];
      M[i][j] +=
          (M[i - 1][j] - (j - A[i] - 1 >= 0 ? M[i - 1][j - A[i] - 1] : 0) +
           1000000007) %
          1000000007;
      M[i][j] %= 1000000007;
    }
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i <= A[0]; i++) M[0][i] = i + 1;
  for (int i = A[0] + 1; i <= k; i++) M[0][i] = M[0][A[0]];
  filly(n, k);
  cout << (M[n - 1][k] - M[n - 1][k - 1] + 1000000007) % 1000000007;
  return 0;
}
