#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int a[101];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long int dp[101][100001] = {0};
  for (long long int i = 0; i < n; i++) dp[i][0] = 1;
  for (long long int i = 1; i <= k; i++) {
    if (i <= a[0]) dp[0][i] = 1;
  }
  for (long long int i = 1; i < n; i++) {
    long long int tmp = 0;
    for (long long int j = 0; j <= k; j++) {
      if (j <= a[i]) {
        tmp += (dp[i - 1][j]) % 1000000007;
        tmp %= 1000000007;
      } else {
        tmp -= (dp[i - 1][j - a[i] - 1]) % 1000000007;
        tmp += (dp[i - 1][j]) % 1000000007;
        tmp %= 1000000007;
      }
      dp[i][j] = tmp;
    }
  }
  cout << dp[n - 1][k] << endl;
}
