#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int N, K;
int a[105];
long long dp[105][100005];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i + 1];
  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];
      if (j > 0) dp[i][j] += dp[i][j - 1];
      if (j - a[i] - 1 >= 0) dp[i][j] -= dp[i - 1][j - a[i] - 1];
      dp[i][j] %= MOD;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
