#include <bits/stdc++.h>
using namespace std;
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
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;
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
  fill((T*)array, (T*)(array + N), val);
}
struct io {
  io() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
};
const int INF = INT_MAX;
const long long int LLINF = 1LL << 60;
const long long int MOD = 1000000007;
const double EPS = 1e-9;
int n, k;
vector<long long int> a;
long long int dp[110][100010];
long long int mod = 1000000007;
long long int modpow(long long int a, long long int n, long long int mod) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long int modMinus(long long int val, long long int m) {
  long long int res = val % m;
  if (res < 0) res += m;
  return res;
}
long long int modAdd(long long int& a, long long int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
int main() {
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i <= n; ++i) dp[i][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      dp[i][j] = modAdd(dp[i - 1][j], dp[i][j - 1]);
      if (j - a[i - 1] - 1 >= 0) {
        dp[i][j] = modMinus(dp[i][j], dp[i - 1][j - a[i - 1] - 1]);
      }
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
