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