#include <bits/stdc++.h>
using namespace std;
signed main(void) {
  long long n, k;
  cin >> n >> k;
  long long arr[n + 1];
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  long long dp[n + 1][k + 1];
  for (long long j = 0; j <= k; j++) {
    dp[1][j] = (j > arr[1]) ? 0 : 1;
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] = (1000000007 + dp[i][j - 1] + dp[i - 1][j] -
                  ((j - 1 - arr[i] >= 0) ? dp[i - 1][j - 1 - arr[i]] : 0)) %
                 1000000007;
    }
  }
  cout << dp[n][k] << endl;
}
