#include <bits/stdc++.h>
using namespace std;
const int N = 101;
const int K = 100001;
long long int dp[N][K];
int main() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] += dp[i - 1][j];
      dp[i][j] = dp[i][j] % 1000000007;
      if (j != 0) {
        dp[i][j] = dp[i][j] + dp[i][j - 1];
        dp[i][j] = dp[i][j] % 1000000007;
      }
      if (j - a[i - 1] - 1 >= 0) {
        dp[i][j] -= dp[i - 1][j - a[i - 1] - 1];
        dp[i][j] = dp[i][j] % 1000000007;
      }
    }
  }
  cout << dp[n][k] << endl;
}
