#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5, mod = 1e9 + 7;
long long n, k, suma = 0, a[N], dp[101][N], sum[101][N];
long long add(long long a, long long b) { return (a % mod + b % mod) % mod; }
long long sub(long long a, long long b) {
  return (a % mod - b % mod + mod * mod) % mod;
}
signed main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  memset(sum, 0, sizeof sum);
  for (long long i = 0; i <= k; i++) {
    sum[0][i] = 1;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      long long lim = j - max(suma, a[i]);
      dp[i][j] = sub(sum[i - 1][j], (lim > 0 ? sum[i - 1][lim - 1] : 0));
      sum[i][j] = add((j ? sum[i][j - 1] : 0), dp[i][j]);
    }
    suma += a[i];
  }
  cout << dp[n][k];
}
