#include <bits/stdc++.h>
using namespace std;
const long long p = 1e9 + 7;
const long long INF = 1LL << 60;
long long dp[111][111111];
int main() {
  long long n, k, a[111];
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    long long sum = 0;
    for (int j = 0; j <= k; j++) {
      sum += dp[i][j];
      if (j - a[i] > 0) sum -= dp[i][j - a[i] - 1];
      sum %= p;
      dp[i + 1][j] += sum;
      dp[i + 1][j] %= p;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
