#include <bits/stdc++.h>
using ll = long long int;
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
ll mod = 1e9 + 7;
int a[100];
ll dp[110][100010];
ll rec(int i, int j) {
  if (j == 0) return 1;
  if (j < 0) return 0;
  if (i == -1) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  ll res = 0;
  return dp[i][j] = (rec(i, j - 1) % mod + rec(i - 1, j) % mod -
                     rec(i - 1, j - a[i] - 1) % mod) %
                    mod;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (n); i++) cin >> a[i];
  for (int i = 0; i < (n + 1); i++) {
    for (int j = 0; j < (k + 1); j++) dp[i][j] = -1;
  }
  cout << rec(n - 1, k) << endl;
}
