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