#include <bits/stdc++.h>
using namespace std;
int dp[120][100100];
int n, k;
int a[120];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= k; i++) dp[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = dp[i - 1][0] % 1000000007;
    for (int j = 1; j <= k; j++) {
      dp[i][j] = ((dp[i - 1][j] - (a[i] >= j ? 0 : dp[i - 1][j - a[i] - 1]) +
                   1000000007) %
                      1000000007 +
                  dp[i][j - 1]) %
                 1000000007;
    }
  }
  cout << dp[n][k] - (k == 0 ? 0 : dp[n][k - 1]) << endl;
  return 0;
}
