#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
ll dp[105][N], ps[105][N];
int a[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    dp[i][0] = ps[i][0] = 1;
  }
  for (int i = 0; i <= k; i++) ps[0][i] = 1;
  dp[0][0] = ps[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      ll lt = j - a[i] - 1 >= 0 ? ps[i - 1][j - a[i] - 1] : 0;
      ll lim = (ps[i - 1][j] - lt) % MOD;
      dp[i][j] = (dp[i][j] + lim) % MOD;
      ps[i][j] = (dp[i][j] + ps[i][j - 1]) % MOD;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
