#include <bits/stdc++.h>
using namespace std;
const int MSIZE = 1e2 + 5;
const int MOD = 1e9 + 7;
int arr[MSIZE];
long long dp[MSIZE][100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= k; j++) {
      dp[i][j] = dp[i][j - 1] + dp[i - 1][j] -
                 (j > arr[i] ? dp[i - 1][j - arr[i] - 1] : 0);
      dp[i][j] %= MOD;
    }
  cout << dp[n][k] << endl;
  return 0;
}
