#include <bits/stdc++.h>
using namespace std;
long long a[101];
long long dp[101][100001];
long long prefix[101][100001];
long long mod = 1000000007LL;
int main() {
  long long n, K;
  cin >> n >> K;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  prefix[0][0] = 1;
  for (int j = 1; j <= K; j++) {
    prefix[0][j] = prefix[0][j - 1];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= K; j++) {
      dp[i][j] = prefix[i - 1][j] -
                 (j - a[i] - 1 >= 0 ? prefix[i - 1][j - a[i] - 1] : 0LL);
      dp[i][j] %= mod;
    }
    prefix[i][0] = dp[i][0];
    for (int j = 1; j <= K; j++) {
      prefix[i][j] = prefix[i][j - 1] + dp[i][j];
      prefix[i][j] %= mod;
    }
  }
  cout << dp[n][K] << endl;
  return 0;
}
