#include <bits/stdc++.h>
using namespace std;
long long n, k, a[110];
long long dp[110][100010];
signed main() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < k + 1; i++) dp[0][i] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j < k + 1; j++) {
      if (j - a[i - 1] - 1 >= 0)
        dp[i][j] = dp[i - 1][j] - dp[i - 1][j - a[i - 1] - 1];
      else
        dp[i][j] = dp[i - 1][j];
    }
    for (long long j = 0; j < k + 1; j++) {
      if (j) dp[i][j] += dp[i][j - 1];
    }
  }
  cout << (dp[n][k] - dp[n][k - 1]) % 1000000007 << endl;
  getchar();
  getchar();
  return 0;
  ;
}
