#include <bits/stdc++.h>
using ll = long long;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double>;
using vvd = std::vector<vd>;
using qi = std::queue<int>;
using vpii = std::vector<std::pair<int, int> >;
using namespace std;
const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 10241024;
long double INFD = 100100100;
template <class T1, class T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <class T1, class T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
template <class T1, class T2>
void update(T1 &a, T2 b) {
  a += b;
  if (a > Mod) a %= Mod;
}
inline void IN(void) { return; }
template <typename First, typename... Rest>
void IN(First &first, Rest &...rest) {
  cin >> first;
  IN(rest...);
  return;
}
inline void OUT(void) {
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void OUT(First first, Rest... rest) {
  cout << first << " ";
  OUT(rest...);
  return;
}
int n, k;
vi a(100);
vvi dp(100, vi(100000));
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  IN(n, k);
  for (int(i) = 0; (i) < (n); (i)++) IN(a[i + 1]);
  for (int(i) = 0; (i) < (n + 1); (i)++) dp[i][0] = 1;
  int sum = 0;
  for (int(i) = (1); (i) <= (n); (i)++) {
    for (int(j) = (1); (j) <= (k); (j)++) {
      dp[i][j] += (dp[i - 1][j] + dp[i][j - 1]) % Mod;
      if (j - a[i] - 1 >= 0)
        dp[i][j] = (dp[i][j] + Mod - dp[i - 1][j - a[i] - 1]);
    }
  }
  OUT(dp[n][k]);
  return 0;
}
