#include <bits/stdc++.h>
using namespace std;
long long n, k, mod = 1000000007;
long long sum[110][100100], dp[110][100100], a[110];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) dp[i][0] = sum[i][0] = 1;
  for (int i = 0; i <= k; i++) sum[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      long long left = j - a[i] - 1 >= 0 ? sum[i - 1][j - a[i] - 1] : 0;
      long long right = sum[i - 1][j];
      long long temp = right - left + mod;
      temp %= mod;
      dp[i][j] += temp;
      dp[i][j] %= mod;
      sum[i][j] = (sum[i][j - 1] + dp[i][j]) % mod;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
