#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void checkmin(T &a, const T &b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, const T &b) {
  if (b > a) a = b;
}
const int inf = 1e9 + 10;
const int maxn = 1e5 + 10;
const long long mod = 1e9 + 7;
long long dp[102][maxn];
int a[maxn];
int main() {
  int k, n;
  cin >> n >> k;
  int tot = 0;
  for (int i = 0; i < n; i++) cin >> a[i], tot += a[i];
  for (int i = 0; i <= a[0]; i++) dp[0][i] = 1;
  for (int i = 1; i < n; i++) {
    int sum = 0;
    for (int j = 0; j <= tot; j++) {
      if (j - a[i] - 1 >= 0) sum = (sum + mod - dp[i - 1][j - a[i] - 1]);
      sum = (sum + dp[i - 1][j]) % mod;
      dp[i][j] = sum;
    }
  }
  cout << dp[n - 1][k] << endl;
  return 0;
}
