#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return (!b) ? a : gcd(b, a % b);
}
int t = 1;
int ti;
const int N = 1e5 + 5;
long long int md = 1e9 + 7;
long long int dp[105][N], a[105], n, k;
void solve() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  vector<int> pref(k + 1, 0);
  for (long long i = 1; i <= n; i++) {
    pref.assign(k + 1, 0);
    pref[0] = dp[i - 1][0];
    for (long long ki = 1; ki <= k; ki++) {
      pref[ki] = dp[i - 1][ki] + pref[ki - 1];
      pref[ki] %= md;
    }
    for (long long ki = 0; ki <= k; ki++) {
      dp[i][ki] = pref[ki] - (ki - a[i] - 1 >= 0 ? pref[ki - a[i] - 1] : 0);
      dp[i][ki] %= md;
    }
  }
  cout << dp[n][k];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
