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