#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000;
const long long MOD = 1000000000 + 7;
const int MAX_N = 100 + 2;
const int MAX_K = 100000 + 2;
long long a[MAX_N];
long long dp[MAX_N][MAX_K];
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    long long tmp = 0;
    for (int j = 0; j <= K; j++) {
      if (j - a[i] - 1 >= 0) tmp -= dp[i - 1][j - a[i] - 1];
      tmp += dp[i - 1][j];
      tmp %= MOD;
      dp[i][j] = tmp;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
