#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
ostream& operator<<(ostream& os, const pair<int, int>& p) {
  os << "[" << p.first << "," << p.second << "]";
  return os;
}
template <class T>
void printArray(const T& arr, string del = string(", ")) {
  for (auto it = begin(arr); it != end(arr); it++) {
    cout << (it != cbegin(arr) ? del : "") << *it;
  }
  cout << "\n";
}
constexpr char delimiter[] = " ";
void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << delimiter;
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T>& vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << delimiter;
  }
  cout << endl;
}
template <class T>
void print(vector<vector<T>>& df) {
  for (auto& vec : df) {
    print(vec);
  }
}
namespace alg {
class BIT {
 private:
  int n;
  vector<int> nodes;

 public:
  BIT(vector<int> v) {
    int size = v.size();
    n = 1;
    while (n < size) {
      n *= 2;
    }
    nodes.resize(n, 0);
    for (int i = 0, i_len = (size); i < i_len; ++i) {
      add(i, v[i]);
    }
  }
  void add(int i, int val) {
    ++i;
    while (i <= n) {
      nodes[i] += val;
      i += i & -i;
    }
  }
  int sum(int i) {
    ++i;
    int ret = 0;
    while (i > 0) {
      ret += nodes[i];
      i -= i & -i;
    }
    return ret;
  }
};
struct UnionFindTree {
  vector<int> nodes;
  UnionFindTree(int N) : nodes(N, -1) {}
  int Root(int i) {
    if (nodes[i] < 0) {
      return i;
    }
    return nodes[i] = Root(nodes[i]);
  }
  bool Connect(int i, int j) {
    auto rootI = Root(i);
    auto rootJ = Root(j);
    if (rootI == rootJ) {
      return false;
    }
    nodes[rootI] += nodes[rootJ];
    nodes[rootJ] = rootI;
    return true;
  }
};
class RollingHash {
 private:
  static constexpr int modNum = 2;
  const array<long long, modNum> mod = {{999999937LL, 1000000007LL}};
  static const long long base = 9973;
  vector<long long> pw[modNum];
  RollingHash() {}

 public:
  int size;
  vector<long long> hs[modNum];
  RollingHash(const string& s) {
    size = s.size();
    for (int i = 0; i < modNum; i++) {
      hs[i].assign(size + 1, 0);
      pw[i].assign(size + 1, 0);
      hs[i][0] = 0;
      pw[i][0] = 1;
      for (int j = 0; j < size; j++) {
        pw[i][j + 1] = pw[i][j] * base % mod[i];
        hs[i][j + 1] = (hs[i][j] * base + s[j]) % mod[i];
      }
    }
  }
  long long Hash(int l, int r, int i) {
    return ((hs[i][r] - hs[i][l] * pw[i][r - l]) % mod[i] + mod[i]) % mod[i];
  }
  array<long long, modNum> Hash(int l, int r) {
    array<long long, modNum> ret;
    for (int i = 0, i_len = (modNum); i < i_len; ++i) ret[i] = Hash(l, r, i);
    return ret;
  }
  bool Match(int l1, int r1, int l2, int r2) {
    bool ret = 1;
    for (int i = 0; i < modNum; i++) ret &= Hash(l1, r1, i) == Hash(l2, r2, i);
    return ret;
  }
  bool Match(int l, int r, array<long long, modNum> h) {
    bool ret = 1;
    for (int i = 0; i < modNum; i++) ret &= Hash(l, r, i) == h[i];
    return ret;
  }
};
vector<long long> Divisor(long long n, bool enableSort = true) {
  vector<long long> ret;
  ret.reserve(2 * sqrt(n) + 1);
  for (long long i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i != 1 && i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  if (enableSort) sort(begin(ret), end(ret));
  return ret;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
long long gcd(vector<T> v) {
  int N = v.size();
  long long ret = v[0];
  for (int i = 0, i_len = (N - 1); i < i_len; ++i) {
    ret = alg::gcd(ret, v[i + 1]);
  }
  return ret;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
template <class T>
long long lcm(vector<T> v) {
  int N = v.size();
  long long ret = v[0];
  for (int i = 0, i_len = (N - 1); i < i_len; ++i) {
    ret = alg::lcm(ret, v[i + 1]);
  }
  return ret;
}
template <class T>
vector<T> TopologicalSort(const vector<vector<T>>& g, vector<T>& h) {
  vector<T> ret;
  stack<T> st;
  auto N = g.size();
  ret.reserve(N);
  for (int i = 0, i_len = (N); i < i_len; ++i)
    if (h[i] == 0) st.push(i);
  while (!st.empty()) {
    auto node = st.top();
    st.pop();
    ret.push_back(node);
    for (const auto& e : g[node]) {
      --h[e];
      if (h[e] == 0) st.push(e);
    }
  }
  return ret;
}
}  // namespace alg
constexpr int maxN = 100;
constexpr int maxK = 100000;
constexpr long long md = 1000000000 + 7;
array<int, maxN> a = {};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<vector<long long>> dp(N, vector<long long>(K + 1, 0));
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    cin >> a[i];
    dp[i][0] = 1;
  }
  for (int j = 0, j_len = (a[0] + 1); j < j_len; ++j) {
    dp[0][j] = 1;
  }
  for (int i = (1), i_len = (N); i < i_len; ++i) {
    long long tmp = 1;
    for (int j = (1), j_len = (K + 1); j < j_len; ++j) {
      tmp = (dp[i - 1][j] + tmp) % md;
      if (j > a[i]) {
        tmp = (tmp - dp[i - 1][j - 1 - a[i]]) % md;
      }
      dp[i][j] = tmp;
    }
  }
  print(dp[N - 1][K]);
}
