#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 105, K = 100005;
long long dp[N][K], pre[N][K];
signed main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (__typeof(n) i = 0; i < n; i++) cin >> a[i];
  for (__typeof(a[0] + 1) i = 0; i < a[0] + 1; i++) dp[0][i] = 1;
  for (__typeof(k + 2) i = 1; i < k + 2; i++)
    pre[0][i] = pre[0][i - 1] + dp[0][i - 1];
  for (__typeof(n) i = 1; i < n; i++) {
    for (__typeof(k + 1) j = 0; j < k + 1; j++) {
      dp[i][j] = (pre[i - 1][j + 1] - pre[i - 1][max(j - a[i], 0ll)]) % mod;
      pre[i][j + 1] = (pre[i][j] + dp[i][j]) % mod;
    }
  }
  return cout << dp[n - 1][k] << endl, 0;
}
